The information in this article applies to:
SUMMARYThis article and the associated .OBJ file are available in the Software Library. The article describes how compiled programs can determine the module name and address offset where a trapped error occurred. This technique can be used in stand-alone compiled programs (BC option /O used) only. MORE INFORMATIONThe following file is available for download from the Microsoft Software Library: ERRADDR.EXEFor more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base: Q119591 How to Obtain Microsoft Support Files from Online ServicesIn a compiled program, if you use ON ERROR GOTO 0 in an error handler, Basic prints a message, such as the following: The offset (00B0 in this example) locates the ON ERROR GOTO 0 statement rather than the statement that caused the error. Therefore, if you use ON ERROR GOTO 0, and you want to locate the statement that caused an error based on the offset, you can use the technique described below. Alternatively, if you used line numbers in your program, you can locate the cause of the error by using the line number shown in the error message (6 in this example). The module ERR.OBJ contains the procedure ErrAddress which obtains the module name and the address offset at which a trappable run-time error occurred. To use ErrAddress, follow these steps.
Example CodeThe following example demonstrates how to use ErrAddress.
Additional query words: VBmsdos trappable 1.00 softlib ERRADDR.EXE kbfile
Keywords : |
Last Reviewed: December 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |