[python-win32] Generate variant datatype VT_I2

Mark Hammond mhammond at skippinet.com.au
Thu Apr 7 21:28:21 CEST 2011


On 4/04/2011 10:30 AM, Thomas Wiens wrote:
> is there a possibility generate a variable in python which equals to the
> VT_I2 variant datatype?

Not easily (although I have long been considering adding support for 
that, but haven't ever got close to an actual implementation)

> The makepy utility generates the following code:
>
> def WriteFlagValue(self, ByteIndex=defaultNamedNotOptArg,
> BitIndex=defaultNamedNotOptArg, pData=defaultNamedNotOptArg):
>
> """Writes single bit, byte, word, or double word to the Control Engine
> Flag memory."""
>
> return self._oleobj_.InvokeTypes(27, LCID, 1, (24, 0), ((3, 1), (3, 1),
> (16396, 1)),ByteIndex
>
> , BitIndex, pData)
>
> The parameter where the variant type is checked is "pData".
> The type definition should be:
> (16396, 1) # 16396 = 0x400C -> 0x4000 = VT_BYREF, 0x000C=12 = VT_VARIANT

I'm not sure what you mean by "should be" - it *is* that, right?

You should be able to change that definition (or just clone it) to 
VT_BYREF|VT_I2 - the object will still be called with a variant and the 
type will be VT_BYREF|VT_I2 - which IIUC is what you want.

(This is what I meant above by "not easily" - an easier way would be to 
introduce a new object called "Variant" and add special support in the 
type-handling code for this object - but that is what I referred to as 
nowhere near an implementation)

HTH,

Mark


More information about the python-win32 mailing list