Q:
In the RxInventor.tlh the definition of some named interface object are declared like this:
_COM_SMARTPTR_TYPEDEF(GenericObject, __uuidof(IDispatch));
It is clear the IDispatch UUID is not one of the interface. This cause a lot of problem in our code.
Can you explain this?
A:
The problem with the smart pointer typedef generation is a problem with Microsoft's implementation of #import and there is nothing we can do about it. All of Inventor's IDispatch supporting interfaces are dispinterfaces, not dual interfaces like AutoCAD's. #import appears to only use the strong IID when the interface is a vtable or a dual. #import puts on dispinterfaces, and uses IDispatch as the interface IID.
This is just another of several reasons to avoid the _com_ptr_t smart pointers, especially since #import only half declares them. It is recommended to stick with CCom(QI)Ptr or CComPtr<> template class, since you will specify the right interface uuid.