
ATL: instantiating a COM object within its own implementation DLL
In an OLE DB Provider if a rowset object is created via
CComObject<Rowset>::CreateInstance inside the Command object, is there
any way to ensure this rowset object will be destructed before the
destruction of the Command object?
David
Quote:
> You would have to use CComObject<> to actually instantiate the
> implementation of classes in ATL.
> In your case, it might be something like
> CComObject<IOscar>* pOscar = NULL;
> CComObject<IOscar>::CreateInstance(&pOscar);
> Remember to do
> pOscar->Addref();
> pOscar->Release(); // If you are not going to pass that interface out
> to some other place. BTW: If you have more qs about ATL, try
> microsoft.public.vc.activex.templatelib newsgroup.
> On Fri, 3 Sep 1999 14:32:25 +0200, "Andreas Huber"
> >I have a DLL implementing a COM object. Additionally, I want it to
have a
> >conventional C style interface that makes use of the COM object. The
> >generated implementation class is called Coscar, the interface
Ioscar.
> >However, attempting a
> > Coscar * pOscar = new Coscar();
> >will not compile since Coscar is abstract.
> >How can I get hold of an instance of Coscar?
> >Andreas
> Girish Bharadwaj [mvp].
> Please do not email queries to me.
> Post them in newsgroups.
> Thank you.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.