Trent Nelson wrote:
> I'm getting outfoxed by a pesky ActiveX control that keeps bombing out 
> with a 'Catastrophic failure' as soon as I try and interact with it:
>
>  >>> from win32com.client import *
>  >>> d = Dispatch('TWS.TwsCtrl.1')
>  >>> d
> <win32com.gen_py.Tws ActiveX Control module._DTws instance at 0x43406520>
>  >>> d.connect('', 7496, 0)
> <snip>
> pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None)

8000FFFF.  That's basically an error that says "something bad happened,
but we're not sure what it was."

Also called "anyone get the license number of that truck that hit me?"

> I came across [1], which notes that 'Catastrophic failure' upon first 
> invoking an ActiveX method is a good indication that the component needs 
> an event loop.  It goes on to suggest some wx.activex-fu along the lines of:
>
>  >>> import wx, wx.activex
>  >>> app = wx.PySimpleApp()
>  >>> f = wx.Frame(None, -1, "")
>  >>> clsid = wx.activex.CLSID('TWS.TwsCtrl.1')
> *** axw = wx.activex.ActiveXWindows(f, clsid)
>  >>> wx.activex.GernerateAXModule(axw, 'Tws', '.', verbose=True)

That doesn't run an event loop.  It might set up a message queue, but in
order to run an event loop and cause window messages to be dispatched,
you have to call app.MainLoop().

Is this a GUI component?  It's difficult for me to tell.  If it is a GUI
component, then you can't just instantiate it in empty space.  You have
to host it inside some GUI application.  I see that it is a socket-based
component.  If they are using asynchronous socket processing, that also
requires that the event loop be actively dispatching.

If this expects to be part of a GUI application, then you are going to
need to write a GUI application for it.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to