Is it possible to retrieve the call stack programmatically in VB6?

后端 未结 5 1994
天涯浪人
天涯浪人 2020-12-03 21:25

When an error occurs in a function, I\'d like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is t

5条回答
  •  一向
    一向 (楼主)
    2020-12-03 21:59

    I'm pretty sure you have to do it the hard way. At a previous job of mine, we had a very elegant error handling process for VB6 with DCOM components. However, it was a lot redundant code that had to be added to every method, so much that we had home-grown tools to insert it all for you.

    I can't provide too much insight on its implementation (both because I've forgotten most of it and there's a chance they may consider it a trade secret). One thing that does stand out was that the method name couldn't be derived at run-time so it was added as a string variable (some developers would copy-paste instead of using the tool and it would lead to error stacks that lied...).

    HTH

提交回复
热议问题