Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create VARIANT with typecode VT_ARRAY | BT_BSTR #80

Open
net147 opened this issue Jun 12, 2015 · 1 comment
Open

Can't create VARIANT with typecode VT_ARRAY | BT_BSTR #80

net147 opened this issue Jun 12, 2015 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@net147
Copy link

net147 commented Jun 12, 2015

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.

@bsha0
Copy link

bsha0 commented Apr 24, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants