When writing a program, we can capture exceptions through the debugging environment provided by the IDE, and view relevant information so that we can fix problems in the program. However, after the software is released, the Environment deployed and running is very different from the debugging environment. Even if the debugging environment has tested a perfect program, it is also difficult to ensure that there are no errors in the actual operation. When a program encounters an error, it often throws a Red Cross warning box to tell us that the program has an error, but this is like a child who does not understand the expression, it just tells you how it hurts, but does not know how it hurts. Fortunately, there is a component called exwatcher that can teach your child how to say the pain in it.
The exwatcher component is used to capture program exceptions and record the location and call stack information of exceptions. onexception is different. It replaces program exception handling functions and classifies exceptions into delphiexception, delphisafecallexception, systemexception, and systemsafecallexception. It also provides different callback functions for these four types of exceptions. At the same time, it is based on Seh (structured exception handling), you need to use the dbg file, that is, you need to publish the dbg file with the same name as the program.
For the implementation principle of exwatcher, see the following article:
Advanced exception handler to find the exception source file name, call stack and all other related information
Advanced exception handler to find the exception source, call stack and more
Http://www.clevercomponents.com/articles/article012/ExWatcher.zip for exwatcher
Demo download: http://www.clevercomponents.com/articles/article012/Demo.zip
To generate a dbg file, you need a small tool, map2dbg, which can convert the map file of dephi to a file in dbg format, to generate a map file, modify project-> options-> linker-> map file and select detailed, or add the compilation command {$ D +, L +} as needed }.
Map2dbg: http://code.google.com/p/map2dbg/
When the map cannot be generated, delete the dproj file, open DPR with IDE, and re-build dproj by IDE.