Move ErrorDialog into ArchHooks.
This commit is contained in:
@@ -682,15 +682,11 @@ int main(int argc, char* argv[])
|
|||||||
SAFE_DELETE( TEXTUREMAN );
|
SAFE_DELETE( TEXTUREMAN );
|
||||||
SAFE_DELETE( DISPLAY );
|
SAFE_DELETE( DISPLAY );
|
||||||
SAFE_DELETE( LOG );
|
SAFE_DELETE( LOG );
|
||||||
SAFE_DELETE( HOOKS );
|
|
||||||
|
|
||||||
if( g_sErrorString != "" )
|
if( g_sErrorString != "" )
|
||||||
{
|
HOOKS->MessageBoxError( g_sErrorString ); // throw up a pretty error dialog
|
||||||
// throw up a pretty error dialog
|
|
||||||
ErrorDialog *d = MakeErrorDialog();
|
SAFE_DELETE( HOOKS );
|
||||||
d->ShowError( g_sErrorString );
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
* prompts. */
|
* prompts. */
|
||||||
enum MessageBoxResult { abort, retry, ignore };
|
enum MessageBoxResult { abort, retry, ignore };
|
||||||
virtual void MessageBoxOK( CString sMessage, CString ID = "" ) {}
|
virtual void MessageBoxOK( CString sMessage, CString ID = "" ) {}
|
||||||
|
virtual void MessageBoxError( CString error ) { printf("Error: %s\n", error.c_str()); }
|
||||||
virtual MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID = "" ) { return ignore; }
|
virtual MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID = "" ) { return ignore; }
|
||||||
|
|
||||||
virtual ~ArchHooks() { }
|
virtual ~ArchHooks() { }
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "archutils/win32/tls.h"
|
#include "archutils/win32/tls.h"
|
||||||
#include "archutils/win32/crash.h"
|
#include "archutils/win32/crash.h"
|
||||||
#include "archutils/win32/DebugInfoHunt.h"
|
#include "archutils/win32/DebugInfoHunt.h"
|
||||||
|
#include "archutils/win32/GotoURL.h"
|
||||||
#include "ProductInfo.h"
|
#include "ProductInfo.h"
|
||||||
|
|
||||||
ArchHooks_Win32::ArchHooks_Win32()
|
ArchHooks_Win32::ArchHooks_Win32()
|
||||||
@@ -83,6 +84,98 @@ void ArchHooks_Win32::MessageBoxOK( CString sMessage, CString ID )
|
|||||||
IgnoreMessage( ID );
|
IgnoreMessage( ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CString g_sErrorString;
|
||||||
|
|
||||||
|
static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
|
{
|
||||||
|
switch( msg )
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
CString sMessage = g_sErrorString;
|
||||||
|
|
||||||
|
sMessage.Replace( "\n", "\r\n" );
|
||||||
|
|
||||||
|
SendDlgItemMessage(
|
||||||
|
hWnd,
|
||||||
|
IDC_EDIT_ERROR,
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)(LPCTSTR)sMessage
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_BUTTON_VIEW_LOG:
|
||||||
|
{
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
STARTUPINFO si;
|
||||||
|
ZeroMemory( &si, sizeof(si) );
|
||||||
|
|
||||||
|
CreateProcess(
|
||||||
|
NULL, // pointer to name of executable module
|
||||||
|
"notepad.exe log.txt", // pointer to command line string
|
||||||
|
NULL, // process security attributes
|
||||||
|
NULL, // thread security attributes
|
||||||
|
false, // handle inheritance flag
|
||||||
|
0, // creation flags
|
||||||
|
NULL, // pointer to new environment block
|
||||||
|
NULL, // pointer to current directory name
|
||||||
|
&si, // pointer to STARTUPINFO
|
||||||
|
&pi // pointer to PROCESS_INFORMATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDC_BUTTON_REPORT:
|
||||||
|
GotoURL( "http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366" );
|
||||||
|
break;
|
||||||
|
case IDC_BUTTON_RESTART:
|
||||||
|
{
|
||||||
|
/* Clear the startup mutex, since we're starting a new
|
||||||
|
* instance before ending ourself. */
|
||||||
|
TCHAR szFullAppPath[MAX_PATH];
|
||||||
|
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
|
||||||
|
|
||||||
|
// Launch StepMania
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
STARTUPINFO si;
|
||||||
|
ZeroMemory( &si, sizeof(si) );
|
||||||
|
|
||||||
|
CreateProcess(
|
||||||
|
NULL, // pointer to name of executable module
|
||||||
|
szFullAppPath, // pointer to command line string
|
||||||
|
NULL, // process security attributes
|
||||||
|
NULL, // thread security attributes
|
||||||
|
false, // handle inheritance flag
|
||||||
|
0, // creation flags
|
||||||
|
NULL, // pointer to new environment block
|
||||||
|
NULL, // pointer to current directory name
|
||||||
|
&si, // pointer to STARTUPINFO
|
||||||
|
&pi // pointer to PROCESS_INFORMATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
EndDialog( hWnd, 0 );
|
||||||
|
break;
|
||||||
|
// fall through
|
||||||
|
case IDOK:
|
||||||
|
EndDialog( hWnd, 0 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ArchHooks_Win32::MessageBoxError( CString error )
|
||||||
|
{
|
||||||
|
g_sErrorString = error;
|
||||||
|
// throw up a pretty error dialog
|
||||||
|
AppInstance handle;
|
||||||
|
DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_ERROR_DIALOG),
|
||||||
|
NULL, ErrorWndProc);
|
||||||
|
}
|
||||||
|
|
||||||
ArchHooks::MessageBoxResult ArchHooks_Win32::MessageBoxAbortRetryIgnore( CString sMessage, CString ID )
|
ArchHooks::MessageBoxResult ArchHooks_Win32::MessageBoxAbortRetryIgnore( CString sMessage, CString ID )
|
||||||
{
|
{
|
||||||
switch( MessageBox(NULL, sMessage, PRODUCT_NAME, MB_ABORTRETRYIGNORE ) )
|
switch( MessageBox(NULL, sMessage, PRODUCT_NAME, MB_ABORTRETRYIGNORE ) )
|
||||||
@@ -94,6 +187,7 @@ ArchHooks::MessageBoxResult ArchHooks_Win32::MessageBoxAbortRetryIgnore( CString
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
|
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public:
|
|||||||
ArchHooks_Win32();
|
ArchHooks_Win32();
|
||||||
void DumpDebugInfo();
|
void DumpDebugInfo();
|
||||||
void MessageBoxOK( CString sMessage, CString ID );
|
void MessageBoxOK( CString sMessage, CString ID );
|
||||||
|
void MessageBoxError( CString error );
|
||||||
MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID );
|
MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user