Hi!

I am trying to use an ActiveX control (.OCX, from a piezo electric stage
controller)) from a Python program. I have managed to get the control to work,
but I am having problems calling a method.

This is the method in question (from the autogenerated typelib):

===
   DISPMETHOD([dispid(20)], c_int, 'GetControlMode',
               ( [], c_int, 'lChanID' ),
               ( [], POINTER(c_int), 'plMode' )),
===

This is what I am doing trying to use the method (it should give me an integer):

===
mode = 0
mode_ptr = cast(mode, POINTER(c_int))
try:
    piezo1.GetControlMode(APTPiezoLib.CHAN1_ID, mode_ptr)
except Exception, e:
    print "Exception:", e
===

And I get:

===
Exception: Cannot put <comtypes._safearray.LP_c_long object at 0x012D9440> in 
VARIANT
===i

I have no previous experience with comtypes or ctypes (or Win32 programming, 
for that matter ;-)), so I might be doing something stupidly wrong. I've tried
all the permutations I could think of already, so I need expert help. 

Thank you very much!

Bye & Good Luck!

Pablo Bianucci.



------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to