[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Getting a Stack Trace in VB6 code

Posted on 2007-08-03
7
Medium Priority
?
3,710 Views
Last Modified: 2008-08-15
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.
0
Comment
Question by:perkinda
  • 3
  • 2
  • 2
7 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 19626625
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
 
LVL 1

Author Comment

by:perkinda
ID: 19627834
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
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 19629234
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Accepted Solution

by:
Anthony2000 earned 2000 total points
ID: 19629840
This tool might help with what you are trying to do.
http://www.babbacom.demon.co.uk/Logger.htm
0
 
LVL 1

Author Comment

by:perkinda
ID: 19630544
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
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19630691
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
 
LVL 1

Author Comment

by:perkinda
ID: 19640678
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question