[python-win32] ActiveX components with Events

Neil Benn neil.benn at arcor.de
Thu Dec 16 00:58:41 CET 2004


Mark Hammond wrote:

>>   However, I have a problem that one of the methods on the ActiveX
>>should show a UI and fire an event.  The python code doesn't
>>show the UI
>>and no events get fired. This does the same thing in VB
>>uncles I wait in
>>a polling loop for my call to the ActiveX component and use the
>>ubiquitous DoEvents call in VB6 - is there something which
>>will allow me
>>to yield control to the OS in the same way as VB6 in Python.
>>    
>>
>
>ActiveX controls need an AX control "container" in order for them to work
>correctly.  win32com by itself currently can not provide such an
>environment.  However, Pythonwin and wxPython both can (Pythonwin by virtue
>of MFC, wxPython by virtue of wxWindows).  I don't know much about
>wxPython's support, but see pythonwin\pywin\demos\ocx for examples of how to
>do it in pythonwin.
>
>Mark
>
>
>  
>
Hello,

          Sorry that was a bad explanation - the control _is_ an ActiveX 
exe - not an ocx - it simply brings up a form (which in actual fact I 
then hide immediatly, I can't stop the form appearing in the first place 
- it has to appear for a few millisecs like a subliminal message).  The 
component is an out of process exe - I did find something like DoEvents 
in pythoncom.PumpWaitingMessages - however I still can't get the 
win32com/python interation working, events are not simply not fired in 
my code.

    I think that I will have to write a thin wrapper in VB or C# to 
access the underlying ActiveX exe (and protect the exe from the 
vagarities of the interface) which can then be accesssed with win32com - 
bit of a pain because it means that I have a maintenance issue (I work 
in a pure python shop and VB/C# code cannot be maintained by anyone 
except for me) but hey, its a protection against future redundancies 
<joke>!  However if you know any gotchyas with ActiveX exe/win32com  
integration that I could look out for then that would be great.

    Thanks for your help.

Cheers,

Neil



More information about the Python-win32 mailing list