Answered by:

HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Question

Hi,
i've done an application which uses COM interop to access some functions of a third party application.
the calls to the COM Object have been copied from an VBA example
the reference to the tlb of the 3rd party application has been added to the project and compared to the referencees set in the vba example file. All references are set the same.

if i compile and run it on my computer everything works just perfect but when i try to run my application on antoher pcs i get:

i've checked the installation and registration of .net and the third party app ,
the vba example is working on every computer just my program doesn't work i checked the paths to the COM references and searched the registry for a component with the CLSID from the error message. i also searched using regdll viewer.

platform is set to x86 , the dll /tlb stuff has been registered an dis the exact same on both pcs

please help me i'm going nuts i'm searching since 2 weeks now, my application is ready to be released it#s just not working on any computer except mine :( thanks in advance.

Answers

HKEY_CLASSEES_ROOT is a legacy registry hive abandoned as far ago as Windows 95. Today, this hive is a calculated merge between HKLM\SOFTWARE\Classes and HKCU\SOFTWARE\Classes. So, what you see as HKCR\3rdpartyappname.objectname is really either
under HKCU\SOFTWARE\Classes or HKLM\SOFTWARE\Classes. Find out which one. This particular registry key that you found is the ProgID registration, which maps a human-readable object name to its preferred ID: The Class ID, or CLSID. This
registry key is really only needed if you don't know the CLSID, so it really is optional.

After that you MUST have (HKCU or HKLM)\Software\Classes\CLSID\<the object's class ID> as stated in my first answer. Since you are not finding this entry, this is why you get the error. Why is the VBA working? I don't really know
as it works with the same mechanism, or so I have thought until today.

Bottom line is: You need those registry keys. If self-registering the ActiveX dll doesn't provide the correct keys then your network installation has to be modified so those entries are included. This way your program will work.

All replies

Class not registered means that the registry keys HKCU\Software\Classes\{744C513B-1EB6-4DA6-89E8-864C87E34A7E}
or HKLM\Software\Classes\{744C513B-1EB6-4DA6-89E8-864C87E34A7E} don't exist or aren't accessible
to the user running the application. You need either one and you need it accessible to the user running the application (registry keys are securable objects, meaning the user must have read access). If you are running this program in a 64-bit PC,
the keys go into the virtualized view for 32-bit. First thing to do: Check that the user running the applciation indeed CAN access the key. Also check the subkeys to make sure the InProcServer32 key value is there and pointing to the right
DLL.

Since the VBA application works, I imagine the keys are in fact there. Is the same user running the VBA and your app? You could write a log file and create a special build of your application that checks on the registry keys manually and logs
the result of the check in the log file.

Hi thank you very much for your help. i really aprreciate it, now i'm understanding at least a little bit more.

In the VBA example there are only 2 references 1. to the tlb of the third party app and 1 OLE Automation (??)

both of them are referenced as the exact same files in my project.

in the registry:
there is an entry called CLSID under HKEY_CLASSES_ROOT 3rdpartyappname.objectname, this is the only entry which is returned when searching for the CLSID, changing / deleting the CLSID number of this entry has no effect, in the CLSID Folder
there 's no CLSID with the ID of the error message. if i create a new one with a placeholder my program is executed correctly.

user is the same (company domain network) , OS is the same (dualboot 2x Win XP prof.), the 3rd party app is the same (network install)

Now i have two questions:

Why is the VBA code working?

How do i know how to create the correct CLSID entry? i tried referencing the tlb file and a lot of other stuff ( 4hours :( )but nothing worked except the fact that now it isn't working on any machine. not even my backup code.

HKEY_CLASSEES_ROOT is a legacy registry hive abandoned as far ago as Windows 95. Today, this hive is a calculated merge between HKLM\SOFTWARE\Classes and HKCU\SOFTWARE\Classes. So, what you see as HKCR\3rdpartyappname.objectname is really either
under HKCU\SOFTWARE\Classes or HKLM\SOFTWARE\Classes. Find out which one. This particular registry key that you found is the ProgID registration, which maps a human-readable object name to its preferred ID: The Class ID, or CLSID. This
registry key is really only needed if you don't know the CLSID, so it really is optional.

After that you MUST have (HKCU or HKLM)\Software\Classes\CLSID\<the object's class ID> as stated in my first answer. Since you are not finding this entry, this is why you get the error. Why is the VBA working? I don't really know
as it works with the same mechanism, or so I have thought until today.

Bottom line is: You need those registry keys. If self-registering the ActiveX dll doesn't provide the correct keys then your network installation has to be modified so those entries are included. This way your program will work.