I have a problem. When I import a COM dll (VB6) in my C# application, All is fine. It compiles and works.
However when I use the app on an other PC, I have an error message :
Unable to cast an object to COM type Installation.VB6FenetreClass Installation._VB6Fenetre interface type. This operation failed because the QueryInterface call on the COM component for the interface with IID {4CD38B1B-45F1-4DC5-910E-3579664306B9} ‘ failed due to the following error: this interface is not supported
(BingTranslated)
But I don’t understand why.
Finally I’ve found the problem. Hans and Chuck you’re right, the problem is my VB6 DLL was not referenced.
When I compile my VB6 DLL, Visual Basic 6.0 registers my DLL automatically in the registry base (Thing that I didn’t notice before).
And in Visual Studio 2005, I didn’t see there is a reference to my VB6 DLL because when I reference it, VS generates an other DLL (if the name of my dll is MYDLL, VS generates a Interop.MYDLL.dll).
So I thought there was only a reference at Interop.MYDLL.dll and not a reference to MYDLL.dll too.
In consequence, we have to copy the VB6 DLL, the .NET DLL on the client computer. Then we have to register the VB6 DLL with the following command :
regsvr32 MYDLL.DLL