Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging VB6 dll from VB6 exe

Tags:

dll

vb6

I have a VB6 program that calls a VB6 DLL which in turn calls another VB6 DLL. When I execute the calling program there is an application error which I am unable to pinpoint so I researched how if it was possible to "see" the error in the dll.

I read Stackoverflow entry question about debugging VB6 dll

and followed the directions of Booji Boy to create a vbg. I also followed his directions and removed the two DLLs from he Reference list. The calling program takes a .txt file as input. When I executed the exe I received this error:

Error Number: 13Description: Type mismatch

The error isn't being generated by the application.

What does this mean? How can I debug this issue?

like image 311
DeveloperM Avatar asked Feb 22 '23 13:02

DeveloperM


1 Answers

You must have all the source code for the EXE and the two DLLs. You add all the projects into single group file i.e. the VBG. You must have a reference in the EXE project to the first DLL. I have no idea why you have been told you have to remove them. You must have a reference in the first DLL project to the second DLL project. VB is clever enough to silently replace the DLL reference with the project reference. It is also clever enough to silently replace the project reference with the DLL reference if you remove a DLL project from the project group.

Make sure you have error handling set to "Break on All Errors" or "Break in Class".

The type mismatch error can occur from simple things like assign a non-numeric string to an numeric variable. It gets more complicated if you are passing object references around. If you see this error occurs on something like:

Set myObject = someOtherObject

... and it looks as if they should be the same type, this might get very complicated. But first, I'll let you do the debug.

like image 75
Mark Bertenshaw Avatar answered Mar 06 '23 00:03

Mark Bertenshaw