1
votes

I'm having some problems incorporating a COM DLL into a C#.NET program. The DLL was given to me by a third party. It was done in VB6. Currently, this is the error I'm receiving.

System.Runtime.InteropServices.COMException was unhandled. HResult=-2147221164 Message=Retrieving the COM class factory for component with CLSID {46F5C9EE-D750-4740- AFBD-682F1E097776} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

It throws the exception when I try to create a new object from one of the classes in the DLL file.

I've tried registering the DLL with regsvr32.exe and using tlbimp.exe to create another DLL (which worked but gave me a tremendous amount of warnings). Everytime I've tried debugging my program I get some sort of exception.

Should I just give up and do this in VB6? I really don't want to...

2
have you tried looking at the dll with dependency walker? I usually find that tool rather useful when dealing with other people's dlls.Jainathan Leung
In their defense, the whole purpose of this project is to interface with another piece of software and provide the user with some form of automation. The original developers only provide a bit of VB6 example code for automating the whole process which is probably why he did what he did.user1828595
What are some errors you get other than the ones you mentioned?D Stanley
did registration with regsvr32 reported that it was succesful?Zdeslav Vojkovic
It seems to me that your component is correctly instantiated now (you forgot to mention you was running this on 64-bit system), and now you have some component specific problem, but I am not 100% sureZdeslav Vojkovic

2 Answers

0
votes

You are missing a DLL in which the thrid party VB6 DLL depends upon. This could be another VB6 DLL or another third party reference (or lower level DLL such as the VB runtime).

The best approach to resolve your issue would be to ask the third party provider which DLL(s) are required as dependencies. As a VB6 developer they should easily be able to answer the question versus you having to run something such as dependency walker which can easily lead you down the wrong path.

0
votes

Okay, I solved the problem. The third party software that the COM DLL gives me access to requires a USB dongle to be inserted into the computer, otherwise it will only run in trial mode. This was prohibiting me from accessing the DLL functionality.