Archive: Register COM objects


Is there a way to register COM objects with the OS during the install?


Any help would be greatly appreciated.


Is it an executible .com file???? That way you could execute it, if not, then I don't know, sorry.



-DJ


No it is not an executable. If it was, i could execute it with the EXEC command.....this COM file is an object file. What I need to do is tell the OS that it can use the functions in this particular COM file.

Sorry if i didnt make that clear before, but i need to tell the os to register these objects and i was wondering if i could do that with the installer.


Unless I am mistaken, a COM object is just another form of an OLE/ActiveX DLL. You should be able to register it with the RegDLL command. If not, I have no idea :/ Probably something that involves writing disgusting 64-bit GUIDs to the registry in several locations...

<sarcasm>Thanks, Microsoft, for such a beautiful programming model!</sarcasm>


There are two different types of COM objects. I'll assume you're using VB to develop the application, so I'll use VB terminology. It should pretty much transfer over to any other development tool.

* ActiveX DLLs / OCXs
The ActiveX DLLs and OCXs must be "registered" by windows before the COM objects they expose can be used. In order to register the DLL (outside of NSIS), you call it's DllRegisterServer() function. NSIS offers the RegDLL statement for that.

When uninstalling your program, it is important to unregister the DLL (so windows knows those COM objects are no longer available). To do this, use NSIS's UnRegDLL statement (or call the DllUnregisterServer() function of the file).

* ActiveX EXEs
These files do not expose a DllSelfRegister function which means RegDLL won't work for them. To register, run the file with the "/regserver" as the command line. To unregister the ActiveX EXE, run it again this time passing "/unregserver" as the command line.

-- Ken Browning