From 5957832a4197aa2554cea8951cd614f753cd5161 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 00:06:15 -0300 Subject: [PATCH] Convert about dialog to TaskDialog --- src/include/86box/language.h | 4 +++ src/win/86Box.rc | 17 +++--------- src/win/win_about.c | 53 ++++++++++-------------------------- 3 files changed, 23 insertions(+), 51 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 2330b385d..473f32d18 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -97,6 +97,10 @@ #define IDS_2121 2121 // "Save changes\nThis will hard..." #define IDS_2122 2122 // "Discard changes\nAll changes..." #define IDS_2123 2123 // "Cancel\nGo back to the..." +#define IDS_2124 2124 // "About " EMU_NAME +#define IDS_2125 2125 // EMU_NAME " v" EMU_VERSION +#define IDS_2126 2126 // "An emulator of old computers..." +#define IDS_2127 2127 // "OK" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 872d4a344..a75236f48 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -274,19 +274,6 @@ END // // Dialog // -DLG_ABOUT DIALOG DISCARDABLE 0, 0, 209, 114 -STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About 86Box" -FONT 9, "Segoe UI" -BEGIN - DEFPUSHBUTTON "OK",IDOK,129,94,71,12 - ICON 100,IDC_ABOUT_ICON,7,7,20,20 - LTEXT "86Box v" EMU_VERSION " - An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information.", - IDC_ABOUT_ICON,54,7,146,73 - CONTROL "",IDC_ABOUT_ICON,"Static",SS_BLACKFRAME | SS_SUNKEN,0, - 86,208,1 -END - DLG_STATUS DIALOG DISCARDABLE 0, 0, 186, 386 STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Status" @@ -974,6 +961,10 @@ BEGIN IDS_2121 "Save changes\nThis will hard reset the emulated machine." IDS_2122 "Discard changes\nAll changes made to the settings will be lost." IDS_2123 "Cancel\nGo back to the Settings window." + IDS_2124 "About " EMU_NAME + IDS_2125 EMU_NAME " v" EMU_VERSION + IDS_2126 "An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information." + IDS_2127 "OK" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_about.c b/src/win/win_about.c index 0c57c346d..bc4beda7d 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -21,6 +21,7 @@ #include #include #undef BITMAP +#include #include #include #include @@ -31,45 +32,21 @@ #include <86box/win.h> -#if defined(__amd64__) || defined(__aarch64__) -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif -AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND h; - HANDLE ih; - - switch (message) { - case WM_INITDIALOG: - plat_pause(1); - h = GetDlgItem(hdlg, IDC_ABOUT_ICON); - ih = LoadImage(hinstance,(PCTSTR)10,IMAGE_ICON,64,64,0); - SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON, - (LPARAM)ih); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - case IDCANCEL: - EndDialog(hdlg, 0); - plat_pause(0); - return TRUE; - - default: - break; - } - break; - } - - return(FALSE); -} - - void AboutDialogCreate(HWND hwnd) { - DialogBox(hinstance, (LPCTSTR)DLG_ABOUT, hwnd, AboutDialogProcedure); + TASKDIALOGCONFIG tdconfig = {0}; + TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2127)}}; + + tdconfig.cbSize = sizeof(tdconfig); + tdconfig.hwndParent = hwnd; + tdconfig.hInstance = hinstance; + tdconfig.dwCommonButtons = 0; + tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_2124); + tdconfig.pszMainIcon = (PCWSTR) 10; + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2125); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2126); + tdconfig.cButtons = ARRAYSIZE(tdbuttons); + tdconfig.pButtons = tdbuttons; + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); }