LONG WINAPI VHandler(PEXCEPTION_POINTERS ExceptionInfo) {
switch (ExceptionInfo->ExceptionRecord->ExceptionCode) {
case EXCEPTION_INT_DIVIDE_BY_ZERO:
_tprintf(_T("divided by zero\n"));
}
return EXCEPTION_CONTINUE_SEARCH;
}
LONG WINAPI VHandler2(PEXCEPTION_POINTERS ExceptionInfo) {
switch (ExceptionInfo->ExceptionRecord->ExceptionCode) {
case EXCEPTION_INT_DIVIDE_BY_ZERO:
_tprintf(_T("divided by zero2\n"));
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
_tprintf(_T("divided by zero2\n"));
}
return EXCEPTION_CONTINUE_SEARCH;
}
int _tmain(int argc, LPCTSTR argv[]) {
double a = 1, b = 0;
AddVectoredExceptionHandler(2, VHandler2);
AddVectoredExceptionHandler(1, VHandler);
_controlfp(~EM_ZERODIVIDE, MCW_EM);
__try {
double c = a / b;
//
}
__except (EXCEPTION_EXECUTE_HANDLER) {
printf("test");
;
}
return 0;
}
VEH.....
最新推荐文章于 2024-07-22 09:38:37 发布