[python-win32] Python, COM, VARIANT, VT_BYREF, Joy!

George Doster docdoster at gmail.com
Fri May 21 16:15:14 CEST 2010


Hello All,

I'm trying to write a Python program that uses a provided ActiveX component.
I have verified the component works ok with Visual Basic.

I have used makepy to build the import module for my ActiveX component.

I can successfully load the component via the ActiveXCtrl class found in
wxPython.

My issue is how to call one of the methods of the ActiveX component. The
method requires a pointer to a variant.

Excerpt from the makepy created module:

def OpenUSB(self, lWarning=
defaultNamedNotOptArg):
        return self._oleobj_.InvokeTypes(1, LCID, 1, (3, 0), ((16387,
0),),lWarning)

As you can see, the first arg is a VT_BYREF | VT_I4.

How do I call this from Python? How do I get a long int pointer to pass to
this function?

I've played around with comtypes and the VARIANT class, but I can't seem to
find the right combo to get what I need.

J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100521/da440596/attachment.html>


More information about the python-win32 mailing list