473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CoCreateInstanc e fails returning class not registered

I have created a basic COM in-proc server and a client.
The registration of my server succeeds according to
regsvr32.
I can see it in the registry, having the ProgID and the
InProcServer32 entries.
I can't seem to find it in the OLE/COM Viewer unless I
specifically open the tlb file.
Opening the dll file by the same method displays an error
loading the type lib, although the dialog box specifies
that I can put in a dll file.
Calling CoCreateInstanc e from the client to instantiate
the server returns class not registered. But as I have
mentioned I can see it in the registry.
What have I done wrong ???

My registry entries :

HKEY_CLASSES_RO OT\CLSID\{57B7A 8A0-E4D7-11d0-818D-444553540000}
The value is the name of my object

HKEY_CLASSES_RO OT\CLSID\{57B7A 8A0-E4D7-11d0-818D-444553540000}\I nprocServer32
The value is the right path to my DLL server

HKEY_CLASSES_RO OT\CLSID\{57B7A 8A0-E4D7-11d0-818D-444553540000}\P rogID
The value is the name of my Dll Server.Object.1

HKEY_CLASSES_RO OT\Name.Object. 1
The value is the name of my Dll Server

HKEY_CLASSES_RO OT\Name.Object. 1\CLSID
The value is {57B7A8A0-E4D7-11d0-818D-444553540000}

This is the code for my DllRegisterServ er :

HINSTANCE g_hinstDll;

const char* g_RegTable[][2]=
{
{"CLSID\\{57B7A 8A0-E4D7-11d0-818D-444553540000}", "SpellCheck er
Object"},
{"CLSID\\{57B7A 8A0-E4D7-11d0-818D-444553540000}\\ InprocServer32" ,(const

char*)-1},
{"CLSID\\{57B7A 8A0-E4D7-11d0-818D-444553540000}\\ ProgID","SpellC hecker.Object.1 "},
{"SpellChecker. Object.1","Spel lChecker Object"},
{"SpellChecker. Object.1\\CLSID ","{57B7A8A 0-E4D7-11d0-818D-444553540000}"}
};

STDAPI DllRegisterServ er()
{
HRESULT hr=S_OK;
char szFileName[MAX_PATH];
HKEY hkey;
GetModuleFileNa me(g_hinstDll,s zFileName,MAX_P ATH);
int nEntries=sizeof (g_RegTable)/sizeof(*g_RegTa ble);
for(int i=0;SUCCEEDED(h r)&&i<nEntries; i++)
{
const char* pszKeyName = g_RegTable[i][0];
const char* pszValue = g_RegTable[i][1];
if(pszValue==(c onst char*)-1)
pszValue=szFile Name;
long err=RegCreateKe y(HKEY_CLASSES_ ROOT,pszKeyName ,&hkey);
if(err==ERROR_S UCCESS)
{
err=RegSetValue ExA(hkey,0,0,RE G_SZ,(const
BYTE*)pszValue, (strlen(pszValu e)+1));
RegCloseKey(hke y);
}
if(err!=ERROR_S UCCESS)
{
DllUnregisterSe rver();
hr=SELFREG_E_CL ASS;
}
}
return hr;
}

This is the idl file :

import "oaidl.idl" ;
import "ocidl.idl" ;
import "unknwn.idl ";

[ object, uuid(00E73D3C-AA86-4d7e-9ED0-72948755C0D0) ]
interface ISpellChecker : IUnknown
{
HRESULT CheckSpelling([in,string] char *word, [out,retval] BOOL
*isCorrect);
HRESULT UseCustomDictio nary([in,string]char *filename);
}

[ uuid(1E4CB38F-6EC4-4807-B459-FC54973A7FE5) ]
library SpellCheckerLib
{
[ uuid(57B7A8A0-E4D7-11d0-818D-444553540000) ]
coclass CSpellChecker
{
interface ISpellChecker;
}
};
What happens is exactly what I have meant to happen.

Why is not that enough ?
What more should be done ?

Thank you!!!

Sep 29 '05 #1
2 9535
Lady_A wrote:
I have created a basic COM in-proc server and a client.
The registration of my server succeeds according to
regsvr32.

[snip]

This newsgroup is for standard C++ language issues, but COM falls
outside of that scope. Please try in
comp.os.ms-windows.program mer.win32 or similar.

Cheers! --M

Sep 29 '05 #2

"Lady_A" <al***********@ gmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I have created a basic COM in-proc server and a client.
The registration of my server succeeds according to
regsvr32.


None of this has anything to do with standard C++ language,
the only topic here.

Try asking about this in a Windows group, e.g.
comp.os.ms-windows.program mer.win32

-Mike
Sep 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
4508
by: Arthur | last post by:
A bit inspired by the decorator discussions, I'm trying to tackle something I had been avoiding. Essentially I am trying to create a non-destructive tranformation of an instance of a class - is one way of putting it. The way I am currently conceptualizing a solution, what I need is a method of the class that returns a new instance of the class. I'm sure this is not new territory.
2
2002
by: David | last post by:
Can anyone tell me why the following code crashes? The pure base class StaticObjectRegistry stores pointers to derived classes upon construction. Later it uses these pointers to call the overridden function ClearStaticData() through its base function Handler(). That is where the code crashes. (I'm using VC++6.0) #include <iostream> #include <list>
15
12830
by: Brian Rogers | last post by:
Hello everyone, I apologize for the cross and re-post, but I am still searching for an answer. Why can C++ can create this object, but C# can't? I am trying to create an instance of the default FTP asynchronous pluggable protocol adaptor, so I can analyse the traffic between urlmon.dll (IE) and the FTP server. The language I am attempting to use is C#.
0
1261
by: Tim Kiely | last post by:
I have a managed C++ class that exposes a COM object to ASP.NET. This COM object creates several other COM objects internally. A VS.NET 2002 build of the dll works fine on .NET 1.0 and 1.1. A VS.NET 2003 build, however, fails when the COM object calls CoCreateInstance. This happens only if the .NET type is used by two web applications on the same server. The first web app to create the .NET type always succeeds and the second web app...
0
2490
by: Naveen | last post by:
Hi I have a component writtten in vc++ registered in MTS. I use MFC DLL which initializes and creates an instance and uninitialize of this MTS component. I use COInitialize ,COCreateInstance and CoUninitialize to perform this. The method which contains this CoInitialize ,CoCreateInstace and CoUninitialize is called by a ATL DLL. When i try to compile this ATL DLL it hangs while performing registration. But if i remove the CoCreateInstance call...
0
1285
by: alvin | last post by:
Dear friends, I am new to vc++ .net programing. Please anyone help me to solve my issue Following is my code: /***********************************************************************************/ CComPtr<IXMLDOMDocumentdoc; HRESULT r = doc.CoCreateInstance(CComBSTR("MSXML2.FreeThreadedDOMDocument.4.0"));
0
1464
by: Kostya | last post by:
Hello. We need to use UserControl-derived components written in C# in our existing MFC application. The components need to be inserted into existing ActiveX controls (written using MFC and ATL as separate OCX files). The recommended way is to turn on the /CLR switch and use CWinFormsControl class. Using this approach I was able to insert a simple test component into one of our ActiveX controls and successfully build the OCX in Debug...
1
3615
by: steveo.uts | last post by:
I've created a web app in C # that creates a self-extracting installation file, and then attempts to digitally sign that file using MS signtool. I'm using the Process class to invoke signtool and it is returning this error: SignTool Error: CoCreateInstance returned error: 0x80040150 Could not read key from registry
6
3626
by: ranin02 | last post by:
Hi, I have a COM method that is called from VBA. This COM method in turn calls CoCreateInstance on a class that is a .NET class with a COM wrapper around it. This all works fine. However, when I kick off that VBA routine from a .NET class within an assembly, I get a class not registered error. When CoCreateInstance is called on that COM visible .Net class a second time, then there is a security violation. To try to make it clearer:
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.