comtypes
comtypes copied to clipboard
Can't create VARIANT with typecode VT_ARRAY | BT_BSTR
http://pythonhosted.org/comtypes/#converting-data-types mentions that some COM server methods require an array of strings with typecode VT_ARRAY | VT_BSTR. Currently, there doesn't seem to be a method of creating a VARIANT with typecode VT_ARRAY | VT_BSTR.
A workaround for this issue:
Start from line 301 of automation.py
elif isinstance(value, (list, tuple)):
if isinstance(value[0], str):
obj = _midlSAFEARRAY(BSTR).create(value)
else:
obj = _midlSAFEARRAY(VARIANT).create(value)
memmove(byref(self._), byref(obj), sizeof(obj))
self.vt = VT_ARRAY | obj._vartype