Commit e5933fa6 authored by chili's avatar chili
Browse files

top level try...catch with messagebox

parent 9b321235
...@@ -26,23 +26,39 @@ int CALLBACK WinMain( ...@@ -26,23 +26,39 @@ int CALLBACK WinMain(
LPSTR lpCmdLine, LPSTR lpCmdLine,
int nCmdShow ) int nCmdShow )
{ {
Window wnd( 800,300,"Donkey Fart Box" ); try
{
Window wnd( 800,300,"Donkey Fart Box" );
MSG msg;
BOOL gResult;
while( (gResult = GetMessage( &msg,nullptr,0,0 )) > 0 )
{
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs
TranslateMessage( &msg );
DispatchMessage( &msg );
}
MSG msg; // check if GetMessage call itself borked
BOOL gResult; if( gResult == -1 )
while( (gResult = GetMessage( &msg,nullptr,0,0 )) > 0 ) {
return -1;
}
// wParam here is the value passed to PostQuitMessage
return msg.wParam;
}
catch( const ChiliException& e )
{ {
// TranslateMessage will post auxilliary WM_CHAR messages from key msgs MessageBox( nullptr,e.what(),e.GetType(),MB_OK | MB_ICONEXCLAMATION );
TranslateMessage( &msg );
DispatchMessage( &msg );
} }
catch( const std::exception& e )
// check if GetMessage call itself borked
if( gResult == -1 )
{ {
return -1; MessageBox( nullptr,e.what(),"Standard Exception",MB_OK | MB_ICONEXCLAMATION );
} }
catch( ... )
// wParam here is the value passed to PostQuitMessage {
return msg.wParam; MessageBox( nullptr,"No details available","Unknown Exception",MB_OK | MB_ICONEXCLAMATION );
}
return -1;
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment