Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create an application using legacy code involving a DLL written in C++.
I left the basic interface the same, but needed to change the name of the DLL and the component. I also changed all the GUID's, including the CLSID of coclass.
However, when I compiled and linked the DLL, I found that the application that used
the dll came back with an error message to the effect that the component I was trying
to instantiate was not registered.
I used Oleview and found out that even though the name of the component was changed,
the CLSID was still the same. I tried searching to code to match to old CLSID, but could not find it anywhere. I searched the registry and all references to the COM component have the new CLSID.
I have tried several times, but the result is always the same. The component shows up Oleview as having the old CLSID. I can't seem to change it, even though it is changed in the code. I even erased it in the registry. Still no luck.
I have changed both the .idl and .rgs files
BTW, have mercy, I know some COM, but I am far from an expert.
What am I missing here?

Additional Information:

First, the dll is successfully registered with the compile and link. "Successfully" in the sense that I get four entries in the registry corresponding to the DLL. The problem is that some of the entries have GUID's matching the new DLL (as listed in the IDL file) and others have them matching the old DLL:

HKEY_CLASSES_ROOT\CLSID\ - New CLSID
HKEY_CLASSES_ROOT\TypeLib\ - OLD CLSID for type library
HKEY_CLASSES_ROOT\ <interface class=""> - NEW CLSID
HKEY_CLASSES_ROOT\Interface\ - Old GUID for type library
HKEY_CLASSES_ROOT\Interface\ - Old GUID for event library

I can erase these, recompile and link and I have the same thing happen.
When I use OleView and open the TLB file, I get the new GUID's. However,
if I open the DLL file itself, all the old GUID's show up.

I have searched through every file associated with the project for the old GUID strings and cannot find a thing.

Any ideas?
Posted
Updated 11-Apr-11 3:29am
v2

I suppose you hit this[^] unfortunately it looks there isn't much info about it on the web.
 
Share this answer
 
You should debug the DllRegisterServer() function to find out which CLSID is registered by your COM-dll and where to change it.
Good luck.
 
Share this answer
 
Comments
fdmaxey 11-Apr-11 9:45am    
Thanks for the reply, but that's not the problem in this case (it was the 1st thing I thought of). See my update.
Check all these things in your code

1) Clsid, Name of Interface in .idl file
2) There are two .rgs file in VS2008, change the name of interface also and changed clsid is same that you given in .idl file.
3) Try to directly execute the .rgs file manually and check is it properly registered or not. May be during changes the file is corrupted.

May be this will help you....
 
Share this answer
 
OK, so CLSID is not of a DLl but of the class. That's better. If the CLSID is not found in the Register in means you software is not installed. You need to use RegDLL or something. RegDLL viewer can be also very helpful: http://www.nirsoft.net/utils/registered_dll_view.html[^]. (There are rare situations when you don't need registration, but I don't think you designed such exotics thing. Step-by-step COM books sometimes show how to do it, but can be also useful in real life.)

The change of CLSID itself cannot help you. ID is ID, unique identifier…

—SA
 
Share this answer
 
Comments
fdmaxey 11-Apr-11 10:00am    
See my update. I changed all GUID's in the IDL file. That should have done it. Thanks

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