Matt Wilbur schrieb:
> Hello All, especially Thomas,
> 
> I'm running into a fairly serious snag calling a method that is supposed to
> take a SAFEARRAY** as input.  The class generated from GetModule is
> 
> IIviSpecAnTrace._methods_ = [
>     COMMETHOD([helpstring(u'This function returns the trace the spectrum
> analyzer aquires.')], HRESULT, 'FetchY',
>               ( ['in', 'out'], POINTER(_midlSAFEARRAY(c_double)),
> 'Amplitude' )),
> 
> <other methods omitted>
> 
> ]
> 
> 
>>From the header file its:
> 
>    public:
>         virtual /* [helpcontext][helpstring] */ HRESULT STDMETHODCALLTYPE
> FetchY(
>             /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *Amplitude) = 0;
> 
> 
> 
> Everything was going swimmingly until I tried to use this function.  Here's
> what I do:
> 
> In [305]: safe2 = (c_double*401)()
> 
> In [306]: safe2
> Out[306]: <__main__.c_double_Array_401 object at 0x0292A670>
> 
> I tried manually creating the SAFEARRAY and passing it to the FetchY method,
> but I got bounced because it looked like the underlying Python code was
> constructing it for me.
> 
> However, the array, when returned, is filled with 0.0.  In fact, whatever I
> fill the array with, it remains unchanged after the call.
> 
> I've verified things work correctly at the C++ level, and I've verified the
> instrument is communicating and sending back the right values.  I'm
> obviously buggering something up, but after a day and a half of
> investigation, I have to admit I'm stumped.  I don't know enough about the
> internals of comtypes to debug this, so I'm hoping Thomas can help me out.

Yes, it looks like the safearray support is still very buggy.

What I (deperately) need are some COM objects that use SAFEARRAY parameters.
Googling for 'IIviSpecAndTrace' I found ivifoundation.org.  It looks like
they provide drivers for a Agilent 54642D mixed signal scope that I have
on my bench, so maybe this could be something.  Matt, can you help me
(maybe off-list) getting started with this?

Thomas


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to