Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!
I am working on MFC dialogue based application,for that I used Dll functionality in COM. DLL is build successfully. I register it with registry editor by using GUID for the interfaces in dll application.I wrote below code for Initialise com object,but it gives error that "Class Not Registered.I also copy the code of my .reg file.
//////////////Dialogue based application code////////////////////
XML
ISum *pISum=NULL;
<pre lang="cs">HRESULT hr=CoInitialize(NULL);
    if(FAILED(hr))
    {
        AfxMessageBox(L&quot;Com Library cannot initialized&quot;,MB_ICONERROR);
        return FALSE;
    }
    hr=CoCreateInstance(CLSID_SumSubtract,NULL,CLSCTX_INPROC_SERVER,IID_ISum,(void **)&amp;pISum);
    if(FAILED(hr))
    {
        AfxMessageBox(L&quot;ISeum Interface cannot be obtained&quot;,MB_ICONERROR);
        return FALSE;
    }</pre>


////////.Reg file code////////////////
C#
REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{996BA870-10DF-44f3-81C1-3C9332ADFE35}]
@="ClassFactoryMFC"
[HKEY_CLASSES_ROOT\CLSID\{996BA870-10DF-44f3-81C1-3C9332ADFE35}\InProcServer32]
@=C:\\Windows\\System32\\ClassFactoryMFC.dll"


Please give me solution!!!
Posted

1 solution

You should use Regsvr32[^] to register COM libraries properly.
 
Share this answer
 
Comments
Venkat Raghvan 3-May-13 10:47am    
I tried to register Com library but it gives me error that "the entry point DllRegisterServer was not found
Richard MacCutchan 3-May-13 10:56am    
Then you need to add the registration code to your DLL and register all your interfaces properly, as described in the MSDN documentation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900