On The Subject of Stack TracesIt is possible to generate stack traces from a VB runtime. However,
you're probably not going to like it. The technique is described in the May 2002 issue of Visual Studio Magazine in the article
Get Debug Info From Production Apps by Dan Fergus. It uses a host of techniques from Matt Curland's excellent "Advanced Visual Basic 6" book to allow VB to determine the program's Instruction Pointer, Stack Pointer and Base Pointer and then use dbghelp.dll to translate these into readable descriptions (assuming that you have generated a Symbolic Debug Info file (PDB) when compiling the application - which means it doesn't work for P-Code apps).
To use the code you need to include a class and 7 modules into the VB code you want stack tracking for, although they are all quite small. Then provided you are running outside the IDE, the VB code is compiled as Native Code and a PDB file has been created you can get a stack trace at any time by calling
m_oSymbols.GetCallStack(). As far as I can tell it seems to work, but it is a shame it is impossible to isolate the code out of your project (I tried, but without success).
The world would have been a much nicer place if VB provided an
App.StackTrace method which worked at any time, but there you go. Actually, the world would have been better if the
App object did anything properly!