CoCreateInstance - Class not registered

Posted on 2006-11-09
Last Modified: 2007-11-27

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.
Question by:PhilC
  • 4
  • 3
LVL 86

Expert Comment

ID: 17909648
Have you also tried

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


Author Comment

ID: 17909684
Yes.  I've tried every iteration of everything I can think of and nothing works.
LVL 86

Accepted Solution

jkr earned 500 total points
ID: 17909816
Then I'd try 'RegMon' ( and check what data in the registry is actually being accessed and find what's going wrong.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

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

Author Comment

ID: 17938407
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 Comment

ID: 17939310
Never mind, I was doing something very very wrong.  Thanks for the help though, that tool was very useful.
LVL 86

Expert Comment

ID: 17939809
You're most welcome ;o)

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Building cUrl in Windows v7.43.0 4 36
PDF library for Delphi 2 128
Better understanding on C++ Class serialization and formats 9 78
gdb doesn't stop on breakpoint 2 89
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question