Am 11.02.2010 02:32, schrieb Pablo Bianucci:

[...]
>>From the documentation of this control, I get this prototype (I don't know if
> that's the right name):
> 
> ---
> Function GetControlMode(lChanID As Long, plMode As Long) As Long
> 
> 
> Parameters
> 
> lChanID - the channel identifier
> plMode - returns the control loop feedback status
> ---
> 
> I found this other funcion, that seems similar and has a code example:
> 
> ---
> Function GetMaxTravel(lChanID As Long, plMaxTravel As Long) As Long
> 
> 
> Parameters
> 
> lChanID - the channel identifier
> plMaxTravel - returns the maximum travel (in microns)
> 
> Example:
> 
> Private Sub cmdGetTravel_Click()
>   
>   Dim sngMaxTravel As Single
>   
>   MG17Piezo1.GetMaxTravel CHAN1_ID, sngMaxTravel
>   
>   ' inform user of piezo max travel
>   MsgBox "Maximum travel of piezo = " & sngMaxTravel
> ---  
> 
> Does this help? 

Well, what you could try out are these code snippets in Python:

<snip>
chanid = 42 # or whatever this needs to be...

print ptr.GetControlMode(chanid) # try to leave out the plMode parameter
print ptr.GetControlMode(chanid, 0) # pass a number for plMode...
print ptr.GetMaxTravle(chanid)
print ptr.GetMaxTravel(chanid, 0)
</snip>

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:

<snip>
# create a variable containing the 'control loop feedback status',
# initialized to some value
mode = c_int(0)

# Call the function, passing the VALUE of chanid,
# and a REFERENCE to the 'mode' variable.
print ptr.GetControlMode(chanid, pass_by_reference(mode))
# The result of the function call should now have been printed,
# and the 'mode' variable should contain an updated value:

print mode.value
</snip>

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.

> 
>> However, it could be that comtypes is not able to call this method...
> 
> I hope not! (crossing fingers... :-))

We'll see.

-- 
Thanks,
Thomas


------------------------------------------------------------------------------
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