[python-win32] PythonWin COM Client Problem Accessing Methods in C++ MFC COM Server

Mark Hammond skippy.hammond at gmail.com
Thu Oct 28 05:16:01 CEST 2010


On 28/10/2010 3:50 AM, Steve Johnston wrote:
> First, a little background to help explain the problem. I have a C++ MFC
> application configured as an Automation COM server. It has a dual
> interface defined in a type library embedded as a resource in the
> executable. The dual interface has been been implemented according to
> the Microsoft help article "TN065: Dual-Interface Support for OLE
> Automation Servers". The application also has dispinterface which
> implements only a small subset of the properties and methods contained
> in the dual interface.

I don't quite understand the above - a "dual interface" is one that 
exposes both vtable and IDispatch implementations of an object - so I'm 
not sure what the additional 'dispinterface' is all about - that "dual 
interface" should have everything needed.

> "C:\Python26\lib\site-packages\win32com\gen_py\D604334A-6198-4BEC-9AE9-6038B7352C9Ax0x2x24\IDualFREDApp.py",
> line 33, in Acos
> return self._oleobj_.InvokeTypes(20, LCID, 1, (5, 0), ((5, 1),),x
> com_error: (-2147352573, 'Member not found.', None, None)
>  >>>

So it looks like win32com is seeing the dual interface OK (and only 
supports using the IDispatch implementation of it.)  It is attempting to 
make the IDispatch call with the member ID specified in the typelib, but 
the object is rejecting the call.

It sounds like your object is responding to a QI for IDispatch and 
returning the secondary 'dispinterface' object - if it just returned the 
IDispatch implementation for the dual interface things would probably work.

Mark


More information about the python-win32 mailing list