Hi,
is there a possibility generate a variable in python which equals to the
VT_I2 variant datatype?
I am using a COM-object where some methods use the VARIANT type as
parameter. The COM objects checks the type of the
VARIANT parameter and then decides what to to with the value.
The problem I have is that all the python types are (minimum) VT_I4 values.
In general the method works with VT_I4, but I also need VT_I2 (VT_I1
would be nice too).
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've tested calling the COM-object from C#, where I have to do the
following to set the correct datatype:
System.Object pData;
System.object dataToWrite;
dataToWrite = (bool)pData; // to write VT_BOOL
dataToWrite = (byte)pData; // to write VT_I1
dataToWrite = BitConverter.ToInt16((byte[])pData, 0);// to write VT_I2
dataToWrite = BitConverter.ToInt32((byte[])pData, 0);// to write VT_I4
prosim.WriteFlagValue(bytepos, bitpos, ref dataToWrite);
Maybe it's possible to do something equal in python, I hope so...
Thanks!
--
Regards
Thomas
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32