[python-win32] What is Variant VT_UI1 in Python?
S. S. Hares
shoaev_hares at yahoo.com
Mon Oct 16 23:42:04 CEST 2006
Hello,
I'm having difficulty passing a VT_UI1 to a COM
object. I've tried passing a list/tuple of bytes but
it's raising an exception. When I pass a buffer, there
is no exception but the returned IAutoLogPacket is
None. What is "an array of bytes"?
Here is the makepy generated method (I'm certain I'm
using early bound dispatch):
# Result is of type IAutoLogPacket
def ProcessPacket(self,
packet=defaultNamedNotOptArg):
"""packet is an array of bytes"""
ret = self._oleobj_.InvokeTypes(32, LCID, 1, (9, 0),
((12, 1),),packet
)
if ret is not None:
ret = Dispatch(ret, 'ProcessPacket',
'{568A44F9-6FB2-4814-8195-BCF6F1409288}',
UnicodeToString=0)
return ret
Here is part of an example working Perl script:
my $LogPacket = "15 00 07 10 40 9A C0 A7 EE FB 9C 00
09 11 04 1C 80 29 F0 94 20";
my $qcat_app = new Win32::OLE 'QCAT5.Application';
my @Bytes = split(/[ \n][ \n]*/, $LogPacket);
my @HexBytes;
foreach (@Bytes)
{
push @HexBytes,eval "0x$_";
}
my $Packet = pack($PackStr, @HexBytes);
my $VarPacket = Variant(VT_UI1, $Packet);
my $Obj = $qcat_app -> ProcessPacket($VarPacket);
print $Obj . "\n";
print $Obj->Text();
I'm using Python 2.4.2 and pywin32 build 209.
Your help is appreciated. Thanks.
- Shoaev
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Python-win32
mailing list