Using Python with COM to communicate with proprietary Windows software

Joakim Persson zaladin at home.se
Tue Sep 13 16:41:41 EDT 2005


On Tue, 13 Sep 2005 10:15:18 +0200, Thomas Heller <theller at python.net>
wrote:

>> This _shouldn't_ be too difficult -- I know which methods must be
>> implemented (basically just some kind of event handling to deal with
>> randomly arriving log points, should be implemented as "onMsg()" on my
>> COM server side, and some other similar methods), but I don't really
>> know how. I have tried doing simple COM servers using win32com, but is
>> it equally possible to implement such a simple thing in comtypes? I
>> didn't find any server side examples in comtypes, but perhaps there is
>> a way?
>
>There is not yet any server support in comtypes, but it will be added.
>In the meantime you could use the ctypes.com package that is included in
>ctypes itself, there are even samples.
>
>Thomas

Thank you, I will try that. Right now I've been trying to use win32com
for the server creation, but I haven't been successful yet (have not
explored it that much yet though). 

I have registered a COM server (it should only implement two methods,
"onMsg()" and "onNotify()", which should print whatever is sent to
them directly to stdout), but I need to create an interface which is
not an IDispatch interface and pass it on to the proprietary COM
server. This connection is needed so that the proprietary COM server
knows where to send the log and control data. 

Registering the COM object in the registry works fine, but how do I
make it look like a custom interface from the proprietary COM servers
point of view? Oh well, I will look at it some more tomorrow and
hopefully come up with a solution...

-- 
Joakim Persson
M.Sc student, CS/E @ LTH



More information about the Python-list mailing list