Search code examples
vb6guiddcom

How do I change a DCOM's guid in vb6?


I have a windows service that is instantiating a dcom object with a certain guid A.

I need to replace that dcom object with a new version. When I create and compile my replacement dcom object it is created with a guid B.

How do I change the replacement dcom object's guid from guid B to guidA?


Solution

  • If you are trying to change the ID on the "server" side (the DLL or application that publishes that specific class), VB does that for you when you choose "no compatibility" in the project properties, "component" tab.

    If you are trying to change which object is instantiated in a "client" (a DLL or application that uses a class published by another dll/app), then you need to change the reference (either through the references, or components, depending on what kind of object we are talking about) so that you point to the new version of the server (the one that publishes he class with the updated GUID). That means removing the current reference and adding a reference to the new server. Provided the names have not changed, everything else should still work as it did before, minor any change in the interface of the classes obviously.

    You do not have direct access to the GUIDs in VB6, as far as I know.