I'm trying to call a third party library with comtypes automation. It
could seem that I have some problems to get the parameters passed into
the method right. In the documentation the "Validate" method is
described to recive an "array of strings" in the 'ItemIDs' argument.
The gen-cached signature is shown below:

    COMMETHOD([dispid(1610743822), helpstring(u'Validates a set of
item ids without adding them to the collection.')], HRESULT,
'Validate',
              ( ['in'], c_int, 'NumItems' ),
              ( ['in'], POINTER(_midlSAFEARRAY(BSTR)), 'ItemIDs' ),
              ( ['out'], POINTER(_midlSAFEARRAY(c_int)), 'Errors' ),
              ( ['in', 'optional'], VARIANT, 'RequestedDataTypes' ),
              ( ['in', 'optional'], VARIANT, 'AccessPaths' )),


I have tried (and searched for) a large number of variants to build
the 'ItemIDs' argument, including:

grp.Validate(1, ['Test.tag'])  #Naive - did not expect this to work


arr = _midlSAFEARRAY(comtypes.BSTR)
x=arr.from_param(('Test.tag',))
grp.Validate(1, x)    #nope
grp.Validate(1, pointer(x))   #no - not this one either


They all return:
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
COMError: (-2147024809, 'The parameter is incorrect.', (None, None,
None, 0, None))


Are there any suggestions what I could do about this?

I also have a similar problem in another method where I need to pass
an array of integers, defined as:

              ( ['in'], POINTER(_midlSAFEARRAY(c_int)), 'ServerHandles' ),

For this argument I've tried array.array('x', (...)) where x is
'i','l','I', and 'L', as well as other ways to build this parameter
without any success. Suggestions would be most helpful.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to