Convert startup errors to TaskDialog
This commit is contained in:
@@ -819,6 +819,20 @@ SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static HRESULT CALLBACK
|
||||||
|
TaskDialogProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData)
|
||||||
|
{
|
||||||
|
switch (message) {
|
||||||
|
case TDN_HYPERLINK_CLICKED:
|
||||||
|
/* open linked URL */
|
||||||
|
ShellExecute(hwnd, L"open", (LPCWSTR) lParam, NULL, NULL, SW_SHOW);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ui_init(int nCmdShow)
|
ui_init(int nCmdShow)
|
||||||
{
|
{
|
||||||
@@ -826,18 +840,31 @@ ui_init(int nCmdShow)
|
|||||||
WNDCLASSEX wincl; /* buffer for main window's class */
|
WNDCLASSEX wincl; /* buffer for main window's class */
|
||||||
RAWINPUTDEVICE ridev; /* RawInput device */
|
RAWINPUTDEVICE ridev; /* RawInput device */
|
||||||
MSG messages; /* received-messages buffer */
|
MSG messages; /* received-messages buffer */
|
||||||
HWND hwnd = NULL; /* handle for our window */
|
HWND hwnd = NULL; /* handle for our window */
|
||||||
HACCEL haccel; /* handle to accelerator table */
|
HACCEL haccel; /* handle to accelerator table */
|
||||||
RECT sbar_rect; /* RECT of the status bar */
|
RECT sbar_rect; /* RECT of the status bar */
|
||||||
int bRet;
|
int bRet;
|
||||||
|
TASKDIALOGCONFIG tdconfig = {0};
|
||||||
|
TASKDIALOG_BUTTON tdbuttons[] = {{IDOK, MAKEINTRESOURCE(IDS_2119)}};
|
||||||
|
|
||||||
|
/* Set up TaskDialog configuration. */
|
||||||
|
tdconfig.cbSize = sizeof(tdconfig);
|
||||||
|
tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS;
|
||||||
|
tdconfig.dwCommonButtons = 0;
|
||||||
|
tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS);
|
||||||
|
tdconfig.pszMainIcon = TD_ERROR_ICON;
|
||||||
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050);
|
||||||
|
tdconfig.cButtons = ARRAYSIZE(tdbuttons);
|
||||||
|
tdconfig.pButtons = tdbuttons;
|
||||||
|
tdconfig.pfCallback = TaskDialogProcedure;
|
||||||
|
|
||||||
|
/* Start settings-only mode if requested. */
|
||||||
if (settings_only) {
|
if (settings_only) {
|
||||||
if (! pc_init_modules()) {
|
if (! pc_init_modules()) {
|
||||||
/* Dang, no ROMs found at all! */
|
/* Dang, no ROMs found at all! */
|
||||||
MessageBox(hwnd,
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120);
|
||||||
plat_get_string(IDS_2056),
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
|
||||||
plat_get_string(IDS_2050),
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(6);
|
return(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,7 +922,7 @@ ui_init(int nCmdShow)
|
|||||||
menuMain, /* menu */
|
menuMain, /* menu */
|
||||||
hinstance, /* Program Instance handler */
|
hinstance, /* Program Instance handler */
|
||||||
NULL); /* no Window Creation data */
|
NULL); /* no Window Creation data */
|
||||||
hwndMain = hwnd;
|
hwndMain = tdconfig.hwndParent = hwnd;
|
||||||
|
|
||||||
ui_window_title(title);
|
ui_window_title(title);
|
||||||
|
|
||||||
@@ -925,10 +952,8 @@ ui_init(int nCmdShow)
|
|||||||
ridev.dwFlags = RIDEV_NOHOTKEYS;
|
ridev.dwFlags = RIDEV_NOHOTKEYS;
|
||||||
ridev.hwndTarget = NULL; /* current focus window */
|
ridev.hwndTarget = NULL; /* current focus window */
|
||||||
if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
|
if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
|
||||||
MessageBox(hwndMain,
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2105);
|
||||||
plat_get_string(IDS_2105),
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(4);
|
return(4);
|
||||||
}
|
}
|
||||||
keyboard_getkeymap();
|
keyboard_getkeymap();
|
||||||
@@ -939,10 +964,8 @@ ui_init(int nCmdShow)
|
|||||||
/* Load the accelerator table */
|
/* Load the accelerator table */
|
||||||
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
||||||
if (haccel == NULL) {
|
if (haccel == NULL) {
|
||||||
MessageBox(hwndMain,
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2104);
|
||||||
plat_get_string(IDS_2104),
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(3);
|
return(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,19 +995,16 @@ ui_init(int nCmdShow)
|
|||||||
/* All done, fire up the actual emulated machine. */
|
/* All done, fire up the actual emulated machine. */
|
||||||
if (! pc_init_modules()) {
|
if (! pc_init_modules()) {
|
||||||
/* Dang, no ROMs found at all! */
|
/* Dang, no ROMs found at all! */
|
||||||
MessageBox(hwnd,
|
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120);
|
||||||
plat_get_string(IDS_2056),
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
|
||||||
plat_get_string(IDS_2050),
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(6);
|
return(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the configured Video API. */
|
/* Initialize the configured Video API. */
|
||||||
if (! plat_setvid(vid_api)) {
|
if (! plat_setvid(vid_api)) {
|
||||||
MessageBox(hwnd,
|
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2089);
|
||||||
plat_get_string(IDS_2089),
|
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
|
||||||
plat_get_string(IDS_2050),
|
|
||||||
MB_OK | MB_ICONERROR);
|
|
||||||
return(5);
|
return(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user