 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lady_A Guest
|
Posted: Thu Sep 29, 2005 7:55 pm Post subject: CoCreateInstance 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 CoCreateInstance 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_ROOTCLSID{57B7A8A0-E4D7-11d0-818D-444553540000}
The value is the name of my object
HKEY_CLASSES_ROOTCLSID{57B7A8A0-E4D7-11d0-818D-444553540000}InprocServer32
The value is the right path to my DLL server
HKEY_CLASSES_ROOTCLSID{57B7A8A0-E4D7-11d0-818D-444553540000}ProgID
The value is the name of my Dll Server.Object.1
HKEY_CLASSES_ROOTName.Object.1
The value is the name of my Dll Server
HKEY_CLASSES_ROOTName.Object.1CLSID
The value is {57B7A8A0-E4D7-11d0-818D-444553540000}
This is the code for my DllRegisterServer :
HINSTANCE g_hinstDll;
const char* g_RegTable[][2]=
{
{"CLSID\{57B7A8A0-E4D7-11d0-818D-444553540000}","SpellChecker
Object"},
{"CLSID\{57B7A8A0-E4D7-11d0-818D-444553540000}\InprocServer32",(const
char*)-1},
{"CLSID\{57B7A8A0-E4D7-11d0-818D-444553540000}\ProgID","SpellChecker.Object.1"},
{"SpellChecker.Object.1","SpellChecker Object"},
{"SpellChecker.Object.1\CLSID","{57B7A8A0-E4D7-11d0-818D-444553540000}"}
};
STDAPI DllRegisterServer()
{
HRESULT hr=S_OK;
char szFileName[MAX_PATH];
HKEY hkey;
GetModuleFileName(g_hinstDll,szFileName,MAX_PATH);
int nEntries=sizeof(g_RegTable)/sizeof(*g_RegTable);
for(int i=0;SUCCEEDED(hr)&&i
{
const char* pszKeyName = g_RegTable[i][0];
const char* pszValue = g_RegTable[i][1];
if(pszValue==(const char*)-1)
pszValue=szFileName;
long err=RegCreateKey(HKEY_CLASSES_ROOT,pszKeyName,&hkey);
if(err==ERROR_SUCCESS)
{
err=RegSetValueExA(hkey,0,0,REG_SZ,(const
BYTE*)pszValue,(strlen(pszValue)+1));
RegCloseKey(hkey);
}
if(err!=ERROR_SUCCESS)
{
DllUnregisterServer();
hr=SELFREG_E_CLASS;
}
}
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 UseCustomDictionary([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!!!
|
|
| Back to top |
|
 |
mlimber Guest
|
Posted: Thu Sep 29, 2005 8:15 pm Post subject: Re: CoCreateInstance fails returning class not registered |
|
|
Lady_A wrote:
| Quote: | 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.programmer.win32 or similar.
Cheers! --M
|
|
| Back to top |
|
 |
Mike Wahler Guest
|
Posted: Thu Sep 29, 2005 8:18 pm Post subject: Re: [OT, redirect] CoCreateInstance fails returning class no |
|
|
"Lady_A" <alexandra.lev (AT) gmail (DOT) com> wrote
| Quote: | 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.programmer.win32
-Mike
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|