为什么C++BUILDER在创建出窗口后就不挂了?? - C++ Builder / Windows SDK/API
Application->Initialize(); Application->MainFormOnTaskBar = true; Application->CreateForm(__classid(TTestForm), &TestForm); Application->Run();
//---------------------------------------void __fastcall TEPSForm::btnDivZeroClick(TObject *Sender){ int i=0; int j=1; j = j/i;}//---------------------------------------void __fastcall TEPSForm::btnNullPClick(TObject *Sender){ char* pData=NULL; *pData = 1;}
void __fastcall TForm1::ApplicationEvents1Exception(TObject *Sender, Exception *E){ Application->Terminate();}
[解决办法]
VCL中的异常处理机制比VC要好。
用断言:assert,可以保证被断言的代码出错就中止。
[解决办法]