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(
LPSTR lpCmdLine,
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;
BOOL gResult;
while( (gResult = GetMessage( &msg,nullptr,0,0 )) > 0 )
// check if GetMessage call itself borked
if( gResult == -1 )
{
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
TranslateMessage( &msg );
DispatchMessage( &msg );
MessageBox( nullptr,e.what(),e.GetType(),MB_OK | MB_ICONEXCLAMATION );
}
// check if GetMessage call itself borked
if( gResult == -1 )
catch( const std::exception& e )
{
return -1;
MessageBox( nullptr,e.what(),"Standard Exception",MB_OK | MB_ICONEXCLAMATION );
}
// wParam here is the value passed to PostQuitMessage
return msg.wParam;
catch( ... )
{
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