By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,371 Members | 1,488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,371 IT Pros & Developers. It's quick & easy.

Doubt in COM

P: 16
Hi,
I am new to COM, Just Starting to learn.
I have doubt in interface.
Ie I Created two interface in com.I am trying to acess that interface methods,

In client:

HRESULT hr =CoInitialize(0);
IAscendServicePtr iIAscService;
hr = ::CoCreateInstance(CLSID_AscendService, NULL, CLSCTX_INPROC_SERVER, IID_IAscendService, (void**)&iIAscService);
if(hr !=0)
return 0;
IAscendAttributePtr iAtrptr;
hr = ::CoCreateInstance(CLSID_AscendAttribute, NULL, CLSCTX_INPROC_SERVER, IID_IAscendAttribute, (void**)&iAtrptr);
if(hr !=0)
return 0;
// The second CoCreateInstance fails , ie it doesnt give that pointer (ie
iAtrptr = NULL)

Why its NuLL..

Can any one guide me.

Thanks
May 28 '07 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
I would replce the CoCreateInstaance with its equivalent:

CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF);
hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
pCF->Release();

Then I would check the HRESULT from Create Instance to see what gives.
May 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.