[python-win32] Python, COM, VARIANT, VT_BYREF, Joy!
Mark Hammond
skippy.hammond at gmail.com
Mon May 24 15:25:04 CEST 2010
On 22/05/2010 12:15 AM, George Doster wrote:
> 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.
You should find that you don't need to supply the argument at all -
win32com should initialize and provide the param for you and return the
final result in the return value - assuming the param is an 'out' param.
Cheers,
Mark
More information about the python-win32
mailing list