We help IT Professionals succeed at work.

CoCreateInstance - Class not registered

PhilC
PhilC used Ask the Experts™
on
Hello-

Having problems with CoCreateInstance:

Here is the call I'm making:
CComPtr<_ComTestData> comTest;
hr = CoCreateInstance(__uuidof(_ComTestData), NULL, CLSCTX_SERVER, IID__ComTestData, (void**)&comTest);

After the CoCreateInstance, hr = 0x80040154, aka Class not registered.  This class is contained in an activex control, which I've imported in stdafx.h via:

#import "C:\PathToMy\ActiveXControl.ocx" named_guids

I've checked the registry via regedit, and the class appears in the registry and to be sure I have unregistered and reregistered the control several times with regsvr32.

Any suggestions on this?  I'm at my whits end.
thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
jkr
Top Expert 2012

Commented:
Have you also tried

hr = CoCreateInstance(CLSID_ComTestData, NULL, CLSCTX_SERVER, IID__ComTestData, (void**)&comTest);

?

Author

Commented:
Yes.  I've tried every iteration of everything I can think of and nothing works.
Top Expert 2012
Commented:
Then I'd try 'RegMon' (http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Regmon.mspx) and check what data in the registry is actually being accessed and find what's going wrong.

Author

Commented:
Ah.  Nice tool.  I'll give it a try, thanks.

Author

Commented:
Ok, got side tracked off this for a couple days-

What I found is that the InprocServer32 value for this ComTestData object is non-existant.  I tried adding it, based on other objects that work fine from the same control, and its giving me a class factory cannot provide requested class.

I suspect something was/is wrong with this control, would that be a reasonable assumption?

Author

Commented:
Never mind, I was doing something very very wrong.  Thanks for the help though, that tool was very useful.
jkr
Top Expert 2012

Commented:
You're most welcome ;o)