2018-07-22 06:40:16 +08:00
|
|
|
#include "mainwindow.h"
|
2018-09-02 03:31:18 +08:00
|
|
|
#include <sstream>
|
2018-07-22 06:40:16 +08:00
|
|
|
#include <QApplication>
|
|
|
|
|
2018-09-02 02:57:25 +08:00
|
|
|
LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS* exception)
|
|
|
|
{
|
2018-09-02 03:31:18 +08:00
|
|
|
MEMORY_BASIC_INFORMATION info = {};
|
|
|
|
VirtualQuery(exception->ExceptionRecord->ExceptionAddress, &info, sizeof(info));
|
2018-09-24 07:36:00 +08:00
|
|
|
wchar_t moduleName[MAX_PATH] = {};
|
|
|
|
GetModuleFileNameW((HMODULE)info.AllocationBase, moduleName, MAX_PATH);
|
|
|
|
|
|
|
|
std::wstringstream errorMsg;
|
|
|
|
errorMsg <<
|
|
|
|
std::uppercase << std::hex <<
|
|
|
|
L"Error code: " << exception->ExceptionRecord->ExceptionCode << std::endl <<
|
|
|
|
L"Error address: " << (DWORD)exception->ExceptionRecord->ExceptionAddress << std::endl <<
|
|
|
|
L"Error in module: " << moduleName << std::endl <<
|
|
|
|
L"Additional info: " << exception->ExceptionRecord->ExceptionInformation[1];
|
2018-09-30 04:05:08 +08:00
|
|
|
MessageBoxW(NULL, errorMsg.str().c_str(), L"Textractor ERROR", MB_ICONERROR);
|
2018-09-02 02:57:25 +08:00
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
2018-07-22 06:40:16 +08:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2018-09-02 03:49:16 +08:00
|
|
|
SetUnhandledExceptionFilter(ExceptionHandler);
|
2018-08-23 00:44:16 +08:00
|
|
|
QApplication a(argc, argv);
|
|
|
|
MainWindow w;
|
|
|
|
w.show();
|
2018-07-22 06:40:16 +08:00
|
|
|
|
2018-08-23 00:44:53 +08:00
|
|
|
return a.exec();
|
2018-07-22 06:40:16 +08:00
|
|
|
}
|