How can I see the VB6 Call Stack Programmatically?

molar
molar used Ask the Experts™
on
Has anybody managed to access the VB call stack from the running program at runtime.

I want to produce an error handling module, this would be tremendously useful information to be able to get at this info.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006

Commented:
you could try

title : Q166275 HOWTO: Debug a Native Code Visual Basic Component in VC++
source : http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q166275

description
-------
you can build your exe or dll with symbols and use any debugger to see the call stack at runtime, or step through code if needed with the directions provided in the KB
-------

hope this helps a bit

Author

Commented:
Thanks for the link. It looks like it's telling me how to debug the code using a separate debugger. What I am really after is a way to access the call stack from within the program itself as it is running.

I seem to remember reading an MS article saying this wasn't something that couldn't be done in VB6, but is supported in VB.NET.  I don't automatically believe MS when they say stuff like that though.

Slimy hack anyone?

Top Expert 2006

Commented:
what do you want to achieve
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

You can do this if you create the symbolic debug info (*.pdb) file and distribute it along with your application:
http://www30.brinkster.com/azrasoun/VB/Components/VBCallStack.htm

Author

Commented:
Hi Bruintje

The way error handling has been done in the projects I have worked on,  often looks a little haphazard. I think that inconsistent error handling, and error handling that is not able to correctly point at the faulty function can damage developer confidence in library functions and so reduces reusability of code.

I am trying to come with a consistent error handling framework which will correctly pinpoint functions containing errors, even where the function containing the error is not the function reporting it.  This could happen for example if a function fails because it is passed invalid arguments by the function that invoked it. Hence what I'd really like is a way for a function to know any point, the chain of functions that invoked it (ie the call stack).

Azrasound.

Thanks for the dll. I'll give it a try. It certainly looks promising.


Author

Commented:
I don't know if either of you have noticed (I only just did) but at the top of this page (on my screen at least) is an ad for "BuildVB". It looks like a commercial addin that is doing pretty much what I was looking for. It may be overkill for what I want, but I'll be checking that out too.



Author

Commented:
I tried your DLL Azrasound. Fantastic. Just what I needed.

Glad I could help  :-)

Commented:
by: molar: I tried your DLL Azrasound. Fantastic. Just what I needed.
Where can I get this DLL. Link is broken now. Can anybody help?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial