[python-win32] VARIANT as byref parameter

Tim Roberts timr at probo.com
Wed Sep 17 00:50:05 CEST 2008


martin.prochnow at team6-kg.de wrote:
> I'm trying to call a COM-function which first parameter is a reference to a VARIANT. The COM object that contains this function supports early-bound automation over MakePy.
>
> The corresponding C-code  is:
>
> LONG lValue;
> lValue = plQueryNote->GetVarSize();
> LPBYTE buff = new BYTE[lValue];
> VARIANT varData;
> varData.vt = VT_BYREF;
> varData.byref = buff;
> plQueryNote->ReadVarBlock(&varData,0,lValue);
>
> I have no idea how to define the VARIANT and how to pass it as byref-style-parameter in python with win32com. I found no documentation for a problem like this in the web. It would be great if someone could help me.

Is the parameter declared as [out,retval] in the type library?  If so,
then Python should create the variant and return it to you:
    varData = QueryNote.ReadVarBlock( 0, lValue )

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list