CExceptionLogger,是一個可以免費使用的C++類,用它可以截獲未處理異常,如:非法存取、棧溢出、被零除等,并可以將異常具體信息記錄到日志文件。這個類源自于MSDN Magazine 2002年3月的一篇專欄文章“Under the Hood: ImPRoved Error Reporting with DBGHELP 5.1”,該文章的作者是 Matt Pietrek。
為了在客戶機器上運行該代碼,必須分發DBGHELP 5.1 動態鏈接庫,這個庫可以從2002年11月以后的平臺SDK中獲得。選擇“Install Debugging Tools for Windows”選項安裝該DLL。此外,還要注重DBGHELP 動態鏈接庫在最新的 Windows 版本中是受到保護 Windows 系統文件,所以請將 DBGHELP 動態鏈接庫放在與應用程序相同的目錄中。
參考資料: Bugslayer, MSJ, August 1998 by John Robbins, http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0898/bugslayer0898.htm Under the Hood, MSDN, March 2002 by Matt Pietrek, http://msdn.microsoft.com/msdnmag/issues/02/03/Hood/Hood0203.asp