• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 811
  • Last Modified:

CreateInstance() fails with error code 1008 in C++ COM

Visual Studio 2010 ULTIMATE - To create both server and client.
OS: VISTA

Module name : Server
Component Name: Maths

I'm trying the following to use the com component.

CoInitialize(NULL);

IMathsPtr ptr;
HRESULT hr = ptr.CreateInstance("Server.Maths"); // To create  the co object.
// here I am getting Invalid class string - during debugging

Open in new window


I have registered the COM component in the registry. During building Server app, it automatically registers.
Also tried with regsvr32 to register.
But here my Question is how to get the valid class string fro registry or any other way.
In Visual studio 2010 ultimate, I am not finding any option for OLE Object viewer!!!

Any body having any point on this, please share.

FYI: I searched this in registry, couldn't find.

Thanks,
Subrat.
0
Subrat (C++ windows/Linux)
Asked:
Subrat (C++ windows/Linux)
  • 3
1 Solution
 
jkrCommented:
Stupif question - what does 'CoInitialize()' return? Chances are that this call returns an error condition and that 'ERROR_NO_TOKEN' (1008) is unrelated.
0
 
Subrat (C++ windows/Linux)Software EngineerAuthor Commented:
CoInitialize() is Success.
0
 
Subrat (C++ windows/Linux)Software EngineerAuthor Commented:
In visuAL STUDIO 2010, it's not generating progid/CLSID as modulename.componentname ex:Server.Maths here.
So I was getting error in client while trying to use this progid.

Create progid mannually during creation of ATL Simple COM Object, solves the problem.
0
 
Subrat (C++ windows/Linux)Software EngineerAuthor Commented:
Root cause and soln is provided.
0

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.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now