#include #include // 例外ハンドラ関数 LONG WINAPI CustomExceptionHandler(EXCEPTION_POINTERS* exceptionPointers) { // 例外に関する処理を実行する printf("Exception occurred!\n"); // 例外ハンドラが例外処理を続行する場合は、 // EXCEPTION_CONTINUE_EXECUTION を返す return EXCEPTION_CONTINUE_EXECUTION; } int main() { // 例外ハンドラの登録 SetUnhandledExceptionFilter(CustomExceptionHandler); // ゼロ除算例外を発生させる int a = 10; int b = 0; int result = a / b; // この行は実行されません printf("Result: %d\n", result); return 0; }