我想使用 C++ Builder 处理所有 C++ 异常以生成崩溃报告,该报告可以帮助我在客户端安装和使用应用程序时对其进行调试。
我尝试使用函数 SetUnhandledExceptionFilter 但它不起作用,因为 VCL 拦截了异常并且不会再次抛出它们。
所以我尝试了这个,它也不起作用:
unsigned int Filter( unsigned int uiExCode, EXCEPTION_POINTERS *pt )
{
// might create the crash dump....
MessageBox( NULL, L"ENFIN", L"", 0 );
return EXCEPTION_CONTINUE_SEARCH;
}
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
try
{
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
__except( Filter( GetExceptionCode(), GetExceptionInformation() ) )
{
// Some code to clear
}
return 0;
}
我不想使用 EurekaLog 或 MadExcept 等外部库。
有谁知道如何防止 VCL 捕获所有异常?
谢谢。