[python-win32] COM server with events and multiple threads

David Janssens dja at info.ucl.ac.be
Thu Jun 2 17:25:59 CEST 2005


I attached a zip file that contains a small python COM server and a 
small VB6 client that reproduces the problem.

The server sends events to the VB6 client, but the problem is the events 
are handled in different threads in the VB6 client.

I would appreciate it if someone could tell me what are the minimal 
changes I need to make to this sample so that each event is handled in 
the same GUI thread.

Also what would be some good COM books to read that are relevant to this 
subject?

Thanks,
David Janssens

Mark Hammond wrote:

>>I don't know how to tell VB6 to use free-threading or how to
>>spawn new
>>threads in VB6 that belong to the MTA. Are you sure it's possible, do
>>you have more information on how to do this?
>>    
>>
>
>I doubt it is possible for the main GUI thread.  I believe VB can create
>threads via API calls, so they are up for grabs.  I meant to say something
>like "the host (in thise case VB) must set the thread-mode.  I doubt VB
>can".
>
>  
>
>>I suppose the problem is
>>quite common to all people who whish to use a VB6 GUI with a
>>python COM server backend.
>>    
>>
>
>I'm not aware of normal single threaded apps doing similarly strange things
>for people.  Using connection-points directly is not common, so maybe VB is
>doing something stange with them.
>
>  
>
>>The events are sent to the GUI as follows: (This is based on
>>a sample I
>>found on the same mailing list, except the sample didn't set the
>>threading model of the component to "free")
>>    
>>
>
>Your original query said "the python COM server has multiple threads running
>in it" - but its still not clear to me what these threads are, or where they
>are created.  Are these multiple-threads just an observed side-effect of the
>code as posted?
>
>Mark
>
>  
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vbtest.zip
Type: application/x-zip-compressed
Size: 5487 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20050602/1ee72a9e/vbtest.bin


More information about the Python-win32 mailing list