Getting a Stack Trace in VB6 code

I have a vb6 that uses a function called from many places and many times.  At some point, I am getting an error and need to have a stack trace to find out where the problem originates.  Is there a way to get a stack trace at a particular point in a vb6 program?  The program has a logger built into it that I could use.
LVL 1
perkindaAsked:
Who is Participating?
 
Anthony2000Connect With a Mentor Commented:
This tool might help with what you are trying to do.
http://www.babbacom.demon.co.uk/Logger.htm
0
 
zorvek (Kevin Jones)ConsultantCommented:
You can't do it without additional code. Here is one example:

http://www.vbaccelerator.com/home/vb/code/Techniques/RunTime_Debug_Tracing/article.asp

Kevin
0
 
perkindaAuthor Commented:
I really need the stack trace at a particular point in the program.  I have tried to get BlackBox to work,  http://www.codeproject.com/tools/blackbox.asp ) but have had no success.  This is supposed to work with VB6.

Have you had any luck using this tool with vb6?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
zorvek (Kevin Jones)ConsultantCommented:
No. I have not used any third party tools.

The VB debugging tools suck in compiled form. Running in the debugger is fine but when your customer crashes the program you have nothing. There are three basic techniques I use. The first and most basic/crude is to wait until bad stuff happens and then put MsgBox statements in what you suspect are the problem areas as you work with the customer. This requires a great deal of analytical skill and luck so as to minimize the customer interaction. But sometimes it's the quickest way to a solution.

Another technique is logging to a file. If designed up front this can work very well. All a customer has to do is send you the log file which, if you put in a decent amount of logging in the right places, will do a lot to help find the problem. I'm trying to do this more and more these days.

A third technique is to insert your own tracing code inside the application. There was a point where I actually preferred this technique and even had some code to edit my source and put in all the trace calls (procedure start and end calls). But that was a long time ago and the code is long gone.

Kevin
0
 
perkindaAuthor Commented:
Thanks Zorvek.  I have already tried all your suggestions, but what I really need is the stack trace when the error occurs.  I know exactly what the error is, but I don't know what is throwing it.

Anthony2000 - I'll try the dll.  This one may work as it is in VB5.  I have tried a c++ dll that was supposed to do the same thing, but I could not get it to work.  I'll let you know!
0
 
Anthony2000Commented:
What I usually do in each of my subs and functions is to add "on error goto error_handler". In the error_handler I log the error as zorvek had suggested. Then I usually can find the problem by looking at the log file. I log the sub/function name along with the err.description.
0
 
perkindaAuthor Commented:
Thanks all for your help.  l could not get the C++  BlackBox dll to work, but the VB5 Babbacomb dll works great - so I gave the points to Anthony
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.