Erik Wilsher schrieb: > After some further digging and testing with other COM-servers, I found > out that I was creating new objects in my client code, rather than > connecting to the active object.
Ok, so I assume your events are working now. > So the hurdle now is to register an > instance of my COM-server (written using comtypes) as the active > object in the ROT. This is quite challenging, and I've tried various > combinations of RegisterActiveObject without any success. Any clues > on how to register an instance would be most welcome. Here is some code that wraps the RegisterActiveObject and RevokeActiveObject functions: <snip> ACTIVEOBJECT_STRONG = 0x0 ACTIVEOBJECT_WEAK = 0x1 import comtypes, ctypes oleaut32 = ctypes.oledll.oleaut32 def RegisterActiveObject(comobj, weak=True): punk = comobj._com_pointers_[comtypes.IUnknown._iid_] clsid = comobj._reg_clsid_ if weak: flags = ACTIVEOBJECT_WEAK else: flags = ACTIVEOBJECT_STRONG handle = ctypes.c_ulong() oleaut32.RegisterActiveObject(punk, ctypes.byref(clsid), flags, ctypes.byref(handle)) return handle.value def RevokeActiveObject(handle): oleaut32.RevokeActiveObject(handle, None) <snip/> RegisterActiveObject(...) can be called with an instance of a COM object implemented with comtypes (I tried it with the test code in comtypes\test\TestComServer.py). I guess this code should go into comtypes\server\__init__.py, but further integration into comtypes\server\localserver.py is probably needed (this I guess from reading the MSDN docs for RegisterActiveObject). -- Thanks, Thomas ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users