Hi Thomas!

On Fri, 12 Feb 2010, Thomas Heller wrote:

The first snip does not work. These are the errors:

> print ptr.GetControlMode(chanid) # try to leave out the plMode parameter

Exception: (-2147352561, 'Parameter not optional.', (None, None, None, 0, 
None))

> print ptr.GetControlMode(chanid, 0) # pass a number for plMode...

Exception: (-2147352571, 'Type mismatch.', ('TypeError: Parameter 1', (0, 
0)))

> If nonthing of the above works, I guess you would have to pass the second 
> parameter
> by reference.  The basic code would have to look something like this; it
> is basically what I assume that VB does:

I've tried that by doing the simplistic thing:

<snip>
mode = c_int(0)
piezo1.GetMaxTravel(APTPiezoLib.CHAN1_ID, byref(mode))
</snip>

And I get:

Exception: Cannot put <cparam 'P' (012D7468)> in VARIANT

I guess that means I do need that pass_by_reference() function to do some 
massaging of types.

> Ok, but what is this pass_by_reference() function?
>
> It should take the argument (a ctypes c_int instance, for example),
> and convert to something that will eventually, in the Invoke call,
> used as BYREF VARIANT argument.
>
> I'll try to come up with some ideas for that if the first code snippet
> above really fails.

Is there anything you would recommend me to read to try to get some ideas 
on my own?

Thanks for your help!

Bye & Good Luck!

Pablo B.


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to