CComContainedObject Question
-
I have a plugin that I'm developing that is used in a COM environment. The issue is, I seem to be able to readily obtain an pointer to a base class of my class, but I'm unable to figure out how to get a pointer to my main class. Here is my class:
class ATL_NO_VTABLE Plugin :
public CDXBaseNTo1,
public CComCoClass< Plugin, &CLSID_Plugin >,
public IDispatchImpl< IPlugin, &IID_IPlugin, &LIBID_MAINLib >,
#if(_ATL_VER < 0x0300)
public CComPropertySupport< Plugin >,
#endif
public IObjectSafetyImpl2< Plugin >,
public IPersistStorageImpl< Plugin >,
public ISpecifyPropertyPagesImpl< Plugin >,
public IPersistPropertyBagImpl< Plugin >,
public CSFVideoPlugin< PLUGINPROPS >The
CSFVideoPlugin
is derived from theISfExchangeProps< PLUGINPROPS >
interface. Then, in another are of the plugin environment, the Property Page to configure it, I can do the following:CComQIPtr< ISfExchangeProps< PLUGINPROPS >, &IID\_ISfExchangeProps > pxPlugin( m\_ppUnk\[ 0 \] );
This part all works fine, and calls into the
pxPlugin
work fine. When inside a method call there, the debugger shows[ATL::CComContainedObject<Plugin>]
as the first "member" ofthis
, so the relationship is known, or so it would seem. But calls like this return a completely bogus pointer:CComQIPtr< Plugin, &IID\_IPlugin > pxPlugin( m\_ppUnk\[ 0 \] );
The memory is in the same basic area, but the values are all messed up, and in fact setting them on occasion can/will crashes. I can't figure out how to query for that CComContainedObject interface. Given that even the debugger has enough information to track it down though, clearly it must be. Any help would be greatly appreciated. If I haven't provided a piece of information that would be useful, please let me know. Thanks, CraigL