register a com dll automatically.  
Author Message
Jakein2006





PostPosted: Visual C++ General, register a com dll automatically. Top

I have a COM dll and I want to register it automatically, I hope that one expert can give me a sample program of how to register a com dll dynamically in the vc program.

I appreciate your help.




Visual C++4  
 
 
Sudeesh





PostPosted: Visual C++ General, register a com dll automatically. Top

in the project -> settings - > custom build -> commands add the following code

regsvr32 "$(TargetPath)"

After linking this code will be executed which will register the com dll.

Regards,
Sudeesh.


 
 
Simple Samples





PostPosted: Visual C++ General, register a com dll automatically. Top

Do you need to make your DLL self-registering If it is not and you need to add self-registeration, then you need to add the DllRegisterServer and DllUnregisterServer functions to your DLL. If for some reason the DLL is self-registering but you need to register it from some other program, then simply call DllRegisterServer. The regsrv32.exe utility essentially just calls either DllRegisterServer or DllUnregisterServer depending on whichever is relevant.

You don't specify what you are using; that is, are you using MFC and/or ATL or neither ATL makes it very easy to make a DLL self-registering and MFC can also make it easy. Are you not using either and need to write the code using just C++



 
 
Sahir Shah





PostPosted: Visual C++ General, register a com dll automatically. Top

I have a COM dll and I want to register it automatically, I hope that one expert can give me a sample program of how to register a com dll dynamically in the vc program.

A COM dll needs to be registered before it runs. If you are trying to register the dll from the application that calls it you can use the ShellExecute function.

e.g. ShellExecute(NULL, NULL, "regsvr32 dllName.dll", NULL, NULL, SW_HIDE);

In a normal deployment scenario the setup program registers the dll