Convert ui_msgbox to TaskDialog

This commit is contained in:
RichardG867
2020-06-17 23:15:04 -03:00
parent 02cdf5e787
commit eee75a7c1d
3 changed files with 23 additions and 19 deletions

View File

@@ -22,8 +22,8 @@
/* String IDs. */ /* String IDs. */
#define IDS_STRINGS 2048 // "86Box" #define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "86Box Error" #define IDS_2049 2049 // "Error"
#define IDS_2050 2050 // "86Box Fatal Error" #define IDS_2050 2050 // "Fatal error"
#define IDS_2051 2051 // "Are you sure you want to save..." #define IDS_2051 2051 // "Are you sure you want to save..."
#define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.." #define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.."
#define IDS_2053 2053 // "Speed" #define IDS_2053 2053 // "Speed"

View File

@@ -891,8 +891,8 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
2048 "86Box" 2048 "86Box"
IDS_2049 "86Box Error" IDS_2049 "Error"
IDS_2050 "86Box Fatal Error" IDS_2050 "Fatal error"
IDS_2051 "Are you sure you want to save the settings?" IDS_2051 "Are you sure you want to save the settings?"
IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
IDS_2053 "Speed" IDS_2053 "Speed"

View File

@@ -43,34 +43,34 @@ int
ui_msgbox(int flags, void *arg) ui_msgbox(int flags, void *arg)
{ {
WCHAR temp[512]; WCHAR temp[512];
DWORD fl = 0; int fl = 0;
PCWSTR icon = NULL;
WCHAR *str = NULL; WCHAR *str = NULL;
WCHAR *cap = NULL; WCHAR *cap = NULL;
switch(flags & 0x1f) { switch(flags & 0x1f) {
case MBX_INFO: /* just an informational message */ case MBX_INFO: /* just an informational message */
fl = (MB_OK | MB_ICONINFORMATION); icon = TD_INFORMATION_ICON;
cap = plat_get_string(IDS_STRINGS); /* "86Box" */ fl = TDCBF_OK_BUTTON;
break; break;
case MBX_ERROR: /* error message */ case MBX_ERROR: /* error message */
fl = TDCBF_OK_BUTTON;
if (flags & MBX_FATAL) { if (flags & MBX_FATAL) {
fl = (MB_OK | MB_ICONERROR); icon = TD_ERROR_ICON;
cap = plat_get_string(IDS_2050); /* "Fatal Error"*/ cap = plat_get_string(IDS_2050); /* "Fatal error" */
} else { } else {
fl = (MB_OK | MB_ICONWARNING); icon = TD_WARNING_ICON;
cap = plat_get_string(IDS_2049); /* "Error" */ cap = plat_get_string(IDS_2049); /* "Error" */
} }
break; break;
case MBX_QUESTION: /* question */ case MBX_QUESTION: /* question */
fl = (MB_YESNOCANCEL | MB_ICONQUESTION); fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON;
cap = plat_get_string(IDS_STRINGS); /* "86Box" */
break; break;
case MBX_QUESTION_YN: /* question */ case MBX_QUESTION_YN: /* question */
fl = (MB_YESNO | MB_ICONQUESTION); fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON;
cap = plat_get_string(IDS_STRINGS); /* "86Box" */
break; break;
} }
@@ -95,14 +95,18 @@ ui_msgbox(int flags, void *arg)
* that if the value of 'arg' is low, its an ID.. * that if the value of 'arg' is low, its an ID..
*/ */
if (((uintptr_t)arg) < ((uintptr_t)65636)) if (((uintptr_t)arg) < ((uintptr_t)65636))
str = plat_get_string((intptr_t)arg); str = MAKEINTRESOURCE((intptr_t)arg);
} }
/* At any rate, we do have a valid (wide) string now. */ /* At any rate, we do have a valid (wide) string now. */
fl = MessageBox(hwndMain, /* our main window */ TaskDialog(hwndMain,
str, /* error message etc */ NULL,
cap, /* window caption */ MAKEINTRESOURCE(IDS_STRINGS),
fl); cap,
str,
fl,
icon,
&fl);
/* Convert return values to generic ones. */ /* Convert return values to generic ones. */
if (fl == IDNO) fl = 1; if (fl == IDNO) fl = 1;