Creating instances of COM objects inside the module
-
I have an ATL project where I define several ATL COM objects. I would like to be able to create instances of these objects inside my module without having to use CoCreateInstance(). Everytime I try to do so it claims the classes are abstract because they do not define QueryInterface,AddRef... Is there a way to create these objects internally without having to call CoCreateInstance? Here's the logic to why I want to do this. I'm using a local class to catch some COM events. The local class implements a COM interface but itself is not a COM object. If I create this class with CoCreateInstance I will only be able to get the Event Sink interface back. The only way that I know of to call methods on this object would be to create a new interface for the object for the local methods I need. I would really like to avoid this. Here is a sample bit of code to show better what I'm trying to do
CEventSink : public _IEvents { public: void Setup(IEventSource *source); } ... CEventSink sink; IEventSource *source; ... CoCreatInstance for source... sink.Setup(source);
Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n -
I have an ATL project where I define several ATL COM objects. I would like to be able to create instances of these objects inside my module without having to use CoCreateInstance(). Everytime I try to do so it claims the classes are abstract because they do not define QueryInterface,AddRef... Is there a way to create these objects internally without having to call CoCreateInstance? Here's the logic to why I want to do this. I'm using a local class to catch some COM events. The local class implements a COM interface but itself is not a COM object. If I create this class with CoCreateInstance I will only be able to get the Event Sink interface back. The only way that I know of to call methods on this object would be to create a new interface for the object for the local methods I need. I would really like to avoid this. Here is a sample bit of code to show better what I'm trying to do
CEventSink : public _IEvents { public: void Setup(IEventSource *source); } ... CEventSink sink; IEventSource *source; ... CoCreatInstance for source... sink.Setup(source);
Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477nQ181265: HOWTO: Create ATL COM Objects[^] --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber CP SearchBar v2.0.2 released
-
Q181265: HOWTO: Create ATL COM Objects[^] --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber CP SearchBar v2.0.2 released
Thanks. That was exactly what i was looking for. Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n