Click here to Skip to main content
15,742,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have developed a C# dll and a MFC application.The functions from the dll are being used in this MFC application.So i build the code the dll is being registered in the registries with a registry key automatically but when i run this through exe in another machine its not writing the CLSID key in the registries. Due it this in the below code the condition is getting failed.

Note: The registry key is writing in the registries only when i build the entire solution.

HRESULT hr = CoInitialize(NULL);
CLSID clsid;
HRESULT hResult = CLSIDFromProgID ( _T("dllfunction"), &clsid);
if (FAILED(hResult))
return ;

So Do i have to change anything in the properties to make this work.
CHill60 19-Jan-15 7:29am    
Did you register the dll on the other PC with the correct version of regsvr32?
Rocky_Bas 19-Jan-15 7:45am    
No, In my machine also i am not registering anything its actually done automatically when the dll is build.

1 solution

You have to explicitely register (see Regasm.exe (Assembly Registration Tool)[^]) your DLL in the 'other machine'
Share this answer
Rocky_Bas 20-Jan-15 1:33am    
Thanks for the reply.
Using the above link i have created a .reg file for the dll and if i run that reg file manually it works fine.But i need one more suggestion. I want to do this automatically instead of doing it manually so i have used ShellExecute statement in the application to execute .reg file but its not writing you this function.Below is the code i have used can u just check is there anything wrong i have done

ShellExecute(NULL, L"open",C:\\DllFun.reg " , NULL, NULL, SW_SHOW);
Rocky_Bas 20-Jan-15 4:33am    
Is there any other way that i can include the Reg file in the MFC application

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