[python-win32] Active-X control

Christopher Brown c-b at asu.edu
Wed Jun 24 01:06:36 CEST 2009


Hi List,

I am using windows xp, python 2.5.4, with build 213 of pywin32. I am 
brand new to pywin32, and I have gathered some info from various web 
searches on how to use the library. I'm clearly doing something wrong.

I am in the process of switching from Matlab to Python, and one thing I 
need to do is to use an ocx library to control some hardware. Here is 
how I do it in matlab, which works just fine:

 >> h_pa5 = actxcontrol('PA5.x',[1 1 1 1])

h_pa5 =

	COM.PA5_x

 >> pa5ret = invoke(h_pa5,'ConnectPA5','USB',1)

pa5ret =

      1

 >> invoke(h_pa5, 'SetAtten', 10)

ans =

      1

 >>


...With python-win32, I seem to be able to connect to the library, but I 
can't issue any commands:

 >>> import win32com.client
 >>> axPA5 = win32com.client.Dispatch("PA5.X")
 >>> axPA5
<COMObject PA5.X>
 >>> axPA5.ConnectPA5('USB',1)
Traceback (most recent call last):
com_error: (-2147418113, 'Catastrophic failure', None, None)
 >>>

What am I doing wrong?

-- 
Christopher Brown, Ph.D.
Department of Speech and Hearing Science
Arizona State University


More information about the python-win32 mailing list