Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "windows.h"
- #include <vector>
- LONG WINAPI CrashHandler(EXCEPTION_POINTERS *)
- {
- MessageBox(NULL, L"Error", L"Error", MB_OK);
- return EXCEPTION_EXECUTE_HANDLER;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- SetUnhandledExceptionFilter(CrashHandler);
- // Crash without exception handler
- std::vector<int> foo(5, 0);
- for (auto& f : foo)
- foo.erase(foo.begin() + 1);
- // Crash with exception handler
- //volatile float* ptr = nullptr;
- //float value = *ptr;
- MessageBox(NULL, L"Done", L"Done", MB_OK);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement