Skip to content

array of BSTR is not supported #347

@matthiasfinger

Description

@matthiasfinger

Hi, I really appreciate the great work to develop comtypes. Many thanks! I miss one feature which is the transfer of BSTR arrays. I suggest to change the following code lines in automation.py:

elif isinstance(value, (list, tuple)):
            isstr = [isinstance(x,str) for x in value]
            if not False in isstr:
                bstrlist = []
                for item in value:
                    bstrlist.append(cast(SysAllocStringLen(item, len(item)),BSTR))
                obj = midlSAFEARRAY(BSTR).create(bstrlist)
            else:
                obj = _midlSAFEARRAY(VARIANT).create(value)
            memmove(byref(self._), byref(obj), sizeof(obj))
            self.vt = VT_ARRAY | obj._vartype_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions