Christopher Brown wrote: > > 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]) > ... > > ...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?
-2147418113 is 0x8000ffff, which is E_UNEXPECTED. That doesn't help very much. The second parameter to actxcontrol are screen coordinates. Some ActiveX controls expect to be installed as components in a GUI. Your Python example doesn't set up a GUI. Does it work in Matlab if you omit the coordinates, like this? h_pa5 = actxcontrol('PA5.x') If not, then you have more work ahead of you. You'll have to create a window and a message loop using one of the Python GUI toolkits. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32