Hi what's wrong with my code I am trying to register the class in registry in the following way but while I am debugging it shows that class is not registered and application crashes.
What is wrong in this code please Help me.
Test::IDiscover *pICalc = NULL;
HRESULT hRes=CoCreateInstance(Test::CLSID_SqlClass, NULL,
CLSCTX_INPROC_SERVER,Test::IID_IDiscover, reinterpret_cast<void**> (&pICalc));
if(hres<0)
cout<<"register failure"<<endl;
else
cout<<"register success"<<endl; // and i am not free the memory any where...
And I also tried like:
IDiscoverPtr pt(__uuid(SqlClass));
HRESULT hRes=CoCreateInstance(Test::CLSID_SqlClass, NULL,
CLSCTX_INPROC_SERVER,Test::IID_IDiscover, reinterpret_cast<void**> (&pICalc));
if(hres<0)
cout<<"register failure"<<endl;
else
cout<<"register success"<<endl;
If I do like this when I debugging this at
IDiscoverPtr pt__uuid(SqlClass));
The debugging goes to this function and shows COM error internally.