A COM interface is not accessible ...

  • Thread starter Thread starter jdyng77
  • Start date Start date
J

jdyng77

Guest
Hi,

I am writing a COM interface, temporarily called IAGenerator (shown below), for a big application. To test the interface, I also write a small client program to test the following code. There is no problem. However, when I move the following code to the big application, the returned h of HRESULT shows "class not registered". Do you know why? If the class was not registered successfully, the small client program would not work either. Thanks for any guidance.

#import "ATLServer.tlb" raw_interfaces_only, raw_native_types, named_guids, auto_search
using namespace ATLServerLib;
//#include "atlserver.tlh"
.....
CoInitialize(NULL);
CComPtr<IAGenerator> aGenerator;
HRESULT h = CoCreateInstance(CLSID_AGenerator, NULL, CLSCTX_ALL, __uuidof(IAGenerator), reinterpret_cast<void**>(&aGenerator));
if (SUCCEEDED(h) && NULL != aGenerator)
aGenerator->Dummy1();

JD

ps. I also try a dumb way to apply the "or" operation to all the CLSCTX enumerations and feed the combination to the CoCreateInstance, but it doesn't help.

Continue reading...
 
Back
Top