Dears,

I have a problem with passing out type parameter to win32com function. In C# 
envirement one of the COM’s function  prototype is:

        int  ActEasyIF.ReadDeviceBlock(string szDevice,   int Isize,  out int 
IpIdata);

when calling the function ,it passes a first element of a int array to the 
third parameter, like this:

        ACTMULTILib.ActEasyIF aa = new ACTMULTILib.ActEasyIF();

        aa.ReadDeviceBlock(“D0”,  10,   out da[0]))

The function read 10 integer value from device’s register D0 to D9,and write 
those integer value to the array da, from 0 to 9 . The function run success in 
C#.

I call this COM function by win32comclient in python

>>> from win32com.client import Dispatch

>>> import pythoncom

>>> parser = Dispatch("ActMulti.ActEasyIF")

>>> parser.ActLogicalStationNumber = 1

>>> parser.Open()

0  #Open device success

>>> da = [0] *10

>>> parser.ReadDeviceBlock("D0", 10, da[0])

(0, 256)  #read data success

>>> da   #but…

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

After call the function, it returns a tuple,the first element means read 
success, second is value read from device’s D0 register, but the value don’t 
write to list da .

I think the problem is the method of passing the third parameter,but how to 
pass "out" parameter  to win32com, is there anything hint?

Thank you very much.
Jianhua

 

 

 
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to