• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 469
  • Last Modified:

Debugging in VB6

Dear Expert,

I have written a DLL with about 10 functions and I have created a test harness (another project with a form) to those functions in the DLL.

I basically have 2 VB6 sessions open, one for the DLL and another for the test harness.

How do I get VB6 into debug mode for the DLL when I'm using the test harness and want to step into the DLL? I can step into the code for the test harness with ease, but I cannot seem to do the same for the DLL.

Regards,
Frohike
0
Frohike
Asked:
Frohike
1 Solution
 
funkyfingerCommented:
On the VB6 with the dll press F8,
Then the exe vb6 run the program,,
This should work.
0
 
FrohikeAuthor Commented:
It does not work when I try it. In fact, I had been doing this already.

The test harness is not an exe, I'm executing it by runnig (F5). When an error occurs whilst calling the DLL function, I can only step into the code that called the DLL function on the test harness, not the DLL function where I believe the error had originally come from.
0
 
imbiribaCommented:
First you need to compile your test harness.
Then you open your dll project with VB and in Project Properties window, in debug options, define the program to run as your test harness.
Good luck.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
FrohikeAuthor Commented:
I just want to clarify something, do you mean go to the Debugging tab and then select teh radio button for Start Program, and then browse for the test harness executable?
0
 
jcoutureCommented:
Try this:  

1. Open your test harness app in VB6.

2. With the test harness app open, click on File -> Add Project

3. Now open the DLL project file.

4. This will add the DLL project to your test harness app.
In other words, you just created a project Group.

5. Now with the DLL .vbp added to the group, you can set a reference to that DLL project
Make sure your harness app is the active application in the group and click
Project -> References menu.
Select your DLL from the list. (Note the the .VBP file will be displayed in the path)

6. Save this project group.
Create your object reference in code like you normally would:
   Dim objX As New myDLLObject

7. Put break points in your project where you access the DLL functions and you'll step right into them.

So if I have a DLL called MyDLL and this dll contains a function called SayHi, then I would have code something like this...
   
   Dim strText as string
   Dim objX As MyDLL
   Set objX = New MyDLL
   
   'Put your code break on the next line so you can step into the DLL function
   strText = objX.SayHi

   'Clean up after yourself.
   Set objX = Nothing

Hope this helps.
0
 
imbiribaCommented:
Yes.
Just as you wrote!
By the way, sorry the tab name is debugging, not debug :-(.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now