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.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
Lambda for random numbers problem 7 121
thread-safe code in c++ 2 122
trigs fail! I thought I knew how to do trignometry 3 83
print bytes of an integer 6 26
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

733 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