From a6bd91b9d41df9e4e44974321aa98c26e0e0689b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 11 Feb 2006 08:00:38 +0000 Subject: [PATCH] use WindowsDialogBox --- .../src/archutils/Win32/CrashHandlerChild.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/stepmania/src/archutils/Win32/CrashHandlerChild.cpp b/stepmania/src/archutils/Win32/CrashHandlerChild.cpp index 3b7b57f9c6..55934a1e1c 100644 --- a/stepmania/src/archutils/Win32/CrashHandlerChild.cpp +++ b/stepmania/src/archutils/Win32/CrashHandlerChild.cpp @@ -11,6 +11,7 @@ #include "archutils/Win32/DialogUtil.h" #include "archutils/Win32/GotoURL.h" #include "archutils/Win32/RestartProgram.h" +#include "archutils/Win32/WindowsDialogBox.h" #include "ProductInfo.h" #include "RageUtil.h" @@ -565,8 +566,16 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data ) return true; } -BOOL APIENTRY CrashDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +class CrashDialog: public WindowsDialogBox { +protected: + virtual bool HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ); +}; + +bool CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) +{ + HWND hDlg = GetHwnd(); + switch(msg) { case WM_INITDIALOG: @@ -623,14 +632,8 @@ void ChildProcess() CloseHandle( SymbolLookup::g_hParent ); SymbolLookup::g_hParent = NULL; - /* Little trick to get an HINSTANCE of ourself without having access to the hwnd ... */ - { - TCHAR szFullAppPath[MAX_PATH]; - GetModuleFileName( NULL, szFullAppPath, MAX_PATH ); - HINSTANCE hHandle = LoadLibrary( szFullAppPath ); - - DialogBoxParam( hHandle, MAKEINTRESOURCE(IDD_DISASM_CRASH), NULL, CrashDlgProc, NULL ); - } + CrashDialog cd; + cd.Run( IDD_DISASM_CRASH ); } }