I want to create an instance of an automation server program (s.a.excel) with SmartPointer from ATL program.

I have imported the tlb libraries with the import statement

#import "caxolesrv.tlb" raw_native_types, no_namespace, named_guids

CComPtr<ICaxOleSrv> m_CaxOleSrv;

What do I have to do to get a new instance of automation server and start it automaticly. With MFC OLE I can use CreateObject(..) but in ATL I cannot find a equivalent function.


To get it without smart pointer was also not succesful

CLSID clsid;
HRESULT hr = -10;
IDispatch *pDisp = NULL;
CLSIDFromProgID(L"CaxOleSrv.Application",&clsid);
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&pDisp);

Thanks for your help,

Thomas