Problem solve Get help with specific problems with your technologies, process and projects.

Why does my DLL work in VB6 but not .NET?

I have a dll created using VB6. It works fine when I call it in VB6. When I call the same in a .NET application, it gives me System.InvalidCastException:QueryInterface for interface Projectname.ClassName failed. I have registered the dll in all the boxes. Everywhere it works fine except with .NET.
I can give some things to look for, but without seeing the code, I'm at a loss with this one. Since there is a casting exception being thrown, is the object typed correctly? The QueryInterface failure is interesting also. Does this object have variants as method parameters or does it return a variant? Is that where the type casting exception is occurring?

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.