From 2b6258139ebef470777b67016543e5c13dff0351 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 24 Mar 2020 19:13:58 -0300 Subject: [PATCH] Revert "Convert existing MessageBox calls to TaskDialog" This reverts commit af6cead246a1301d57308dcf264af36d40a313b4. --- src/win/win_dialog.c | 46 ++++++++++++++++++---------------------- src/win/win_ui.c | 50 +++++++++++++------------------------------- 2 files changed, 35 insertions(+), 61 deletions(-) diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 1fca7cfd1..5d867f67f 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -43,36 +43,34 @@ int ui_msgbox(int flags, void *arg) { WCHAR temp[512]; - WCHAR *icon = NULL; - TASKDIALOG_COMMON_BUTTON_FLAGS buttons = TDCBF_OK_BUTTON; + DWORD fl = 0; WCHAR *str = NULL; - WCHAR *instr = NULL; - int res = 0; + WCHAR *cap = NULL; switch(flags & 0x1f) { case MBX_INFO: /* just an informational message */ - icon = TD_INFORMATION_ICON; - instr = plat_get_string(IDS_STRINGS); /* "86Box" */ + fl = (MB_OK | MB_ICONINFORMATION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ break; case MBX_ERROR: /* error message */ if (flags & MBX_FATAL) { - icon = TD_ERROR_ICON; - instr = plat_get_string(IDS_2050); /* "Fatal Error"*/ + fl = (MB_OK | MB_ICONERROR); + cap = plat_get_string(IDS_2050); /* "Fatal Error"*/ } else { - icon = TD_WARNING_ICON; - instr = plat_get_string(IDS_2049); /* "Error" */ + fl = (MB_OK | MB_ICONWARNING); + cap = plat_get_string(IDS_2049); /* "Error" */ } break; case MBX_QUESTION: /* question */ - buttons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON; - instr = plat_get_string(IDS_STRINGS); /* "86Box" */ + fl = (MB_YESNOCANCEL | MB_ICONQUESTION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ break; case MBX_QUESTION_YN: /* question */ - buttons = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON; - instr = plat_get_string(IDS_STRINGS); /* "86Box" */ + fl = (MB_YESNO | MB_ICONQUESTION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ break; } @@ -101,21 +99,17 @@ ui_msgbox(int flags, void *arg) } /* At any rate, we do have a valid (wide) string now. */ - TaskDialog(hwndMain, /* our main window */ - NULL, /* no icon resource */ - plat_get_string(IDS_STRINGS), /* window caption */ - instr, /* main instruction */ - str, /* error message */ - buttons, - icon, - &res); /* pointer to result */ + fl = MessageBox(hwndMain, /* our main window */ + str, /* error message etc */ + cap, /* window caption */ + fl); /* Convert return values to generic ones. */ - if (res == IDNO) res = 1; - else if (res == IDCANCEL) res = -1; - else res = 0; + if (fl == IDNO) fl = 1; + else if (fl == IDCANCEL) fl = -1; + else fl = 0; - return(res); + return(fl); } diff --git a/src/win/win_ui.c b/src/win/win_ui.c index df7a549c7..cfe5d37fb 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -843,14 +843,10 @@ ui_init(int nCmdShow) if (settings_only) { if (! pc_init_modules()) { /* Dang, no ROMs found at all! */ - TaskDialog(hwnd, - NULL, - plat_get_string(IDS_STRINGS), - plat_get_string(IDS_2050), + MessageBox(hwnd, plat_get_string(IDS_2056), - TDCBF_OK_BUTTON, - TD_ERROR_ICON, - NULL); + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); return(6); } @@ -937,14 +933,10 @@ ui_init(int nCmdShow) ridev.dwFlags = RIDEV_NOHOTKEYS; ridev.hwndTarget = NULL; /* current focus window */ if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) { - TaskDialog(hwnd, - NULL, - plat_get_string(IDS_STRINGS), - plat_get_string(IDS_2050), + MessageBox(hwndMain, plat_get_string(IDS_2114), - TDCBF_OK_BUTTON, - TD_ERROR_ICON, - NULL); + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); return(4); } keyboard_getkeymap(); @@ -955,14 +947,10 @@ ui_init(int nCmdShow) /* Load the accelerator table */ haccel = LoadAccelerators(hinstance, ACCEL_NAME); if (haccel == NULL) { - TaskDialog(hwnd, - NULL, - plat_get_string(IDS_STRINGS), - plat_get_string(IDS_2050), + MessageBox(hwndMain, plat_get_string(IDS_2113), - TDCBF_OK_BUTTON, - TD_ERROR_ICON, - NULL); + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); return(3); } @@ -992,27 +980,19 @@ ui_init(int nCmdShow) /* All done, fire up the actual emulated machine. */ if (! pc_init_modules()) { /* Dang, no ROMs found at all! */ - TaskDialog(hwnd, - NULL, - plat_get_string(IDS_STRINGS), - plat_get_string(IDS_2050), + MessageBox(hwnd, plat_get_string(IDS_2056), - TDCBF_OK_BUTTON, - TD_ERROR_ICON, - NULL); + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); return(6); } /* Initialize the configured Video API. */ if (! plat_setvid(vid_api)) { - TaskDialog(hwnd, - NULL, - plat_get_string(IDS_STRINGS), - plat_get_string(IDS_2050), + MessageBox(hwnd, plat_get_string(IDS_2095), - TDCBF_OK_BUTTON, - TD_ERROR_ICON, - NULL); + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); return(5); }