On 22/03/2012 2:53 AM, Jan Wedel wrote:
Hi,
I'm currently having trouble to write a COM-Server that has some special
requirements:
- It needs to derive from IUnknown
- It needs to implement multiple interface from two different
proprietary typelibs (dlls)
- It needs to implement a custom category
At first I started with pythoncom. I used the attribute _reg_catids_ to
specify the category and _com_interfaces_ to specify the interfaces I
want to implement. The client (proprietary 3rd party sw, no source) sees
the server but throws some 0x80004005 error on CoCreateInstance.
That's E_FAIL which is pretty generic. Doesn't sound like a simple
failure to QI for the correct interface.
win32com should be able to do this given there is a tlb - see the
"pippo" samples. Further, using the debug facilities and
win32traceutil, you should be able to see the creation of the object,
the QIs on the object and any methods actually called. But as
mentioned, I doubt it is a QI failure.
I was hoping that I can just tell the COM dispatcher, "yes, I have these
interface implemented" and implement the methods without really having
the interface classes available.
I read, that pythoncom can only create components that use IDispatch so
I guess the _com_interfaces_ idea won't work, will it?
As above, you should be able to fully implement them so long as makepy
has been run.
Then I did some further research and found comtypes. I tried to write a
server stub again. I used GetModule to load the type library containing
the Interfaces, importing the generated interface classes and let the
main server class extend these interfaces.
The first problem was, that comtypes did not support the _reg_catids_
attribute or anything similar so I had to add the Implemented Categories
key manually to the registry.
Then, I was able to see the server through the client, which obviously
filters by categories, but it still shows the same error as before.
So, what is the correct/best way to implement a server that needs to
implement custom interfaces and categories? Or is it possible at all
using python?
The fact you get the same error there implies something else is going
wrong, but it is impossible to guess what. Have you tried contacting
the author of the object?
Mark
Thanks!
//Jan
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32