https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c035f4648ba3aa610fb9ab...
commit c035f4648ba3aa610fb9ab77645103931e7e02dd Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Fri Aug 17 21:46:50 2018 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Fri Aug 17 21:50:08 2018 +0200
[ROSTESTS] Add a test for the MB_SERVICE_NOTIFICATION flag of the MessageBox*() APIs. --- .../rostests/win32/user32/messagebox/messagebox.c | 39 ++++++++++++++++++---- .../rostests/win32/user32/messagebox/resource.h | 4 +-- 2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/modules/rostests/win32/user32/messagebox/messagebox.c b/modules/rostests/win32/user32/messagebox/messagebox.c index 40913e6142..ce4fcebd16 100644 --- a/modules/rostests/win32/user32/messagebox/messagebox.c +++ b/modules/rostests/win32/user32/messagebox/messagebox.c @@ -1,7 +1,8 @@ /* * PROJECT: ReactOS Tests * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) - * PURPOSE: Tests the undocumented user32.dll API SoftModalMessageBox(). + * PURPOSE: Tests the undocumented user32.dll API SoftModalMessageBox() + * and the MB_SERVICE_NOTIFICATION flag of the MessageBox*() APIs. * COPYRIGHT: Copyright 2018 Hermes Belusca-Maito */
@@ -63,16 +64,16 @@ C_ASSERT(sizeof(MSGBOXDATA) == 0x4C); #endif
-typedef int (WINAPI *SOFTMODALMESSAGEBOX)(LPMSGBOXDATA lpMsgBoxData); -// int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData); -SOFTMODALMESSAGEBOX SoftModalMessageBox = NULL; - // // Example taken from http://rsdn.org/forum/winapi/3273168.1 // See also http://www.vbforums.com/showthread.php?840593-Message-Box-with-Four-Buttons // -int wmain(int argc, WCHAR* argv[]) +void TestSoftModalMsgBox(void) { + typedef int (WINAPI *SOFTMODALMESSAGEBOX)(LPMSGBOXDATA lpMsgBoxData); + // int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData); + SOFTMODALMESSAGEBOX SoftModalMessageBox = NULL; + MSGBOXDATA data; int res = 0;
@@ -113,8 +114,32 @@ int wmain(int argc, WCHAR* argv[]) else { res = SoftModalMessageBox(&data); - printf("Returned value = %i\n\n", res); + printf("Returned value = %i\n", res); } +} + +void TestMsgBoxServiceNotification(void) +{ + int res; + + res = MessageBoxW(NULL, L"Hello World!", L"MB_SERVICE_NOTIFICATION", + MB_YESNOCANCEL | MB_DEFBUTTON3 | MB_ICONINFORMATION | /* MB_DEFAULT_DESKTOP_ONLY | */ MB_SERVICE_NOTIFICATION); + printf("Returned value = %i\n", res); +} + +int wmain(int argc, WCHAR* argv[]) +{ + printf("Testing SoftModalMessageBox()...\n"); + TestSoftModalMsgBox(); + printf("\n"); + + printf("Press any key to continue...\n"); + _getch(); + printf("\n"); + + printf("Testing MB_SERVICE_NOTIFICATION...\n"); + TestMsgBoxServiceNotification(); + printf("\n");
printf("Press any key to quit...\n"); _getch(); diff --git a/modules/rostests/win32/user32/messagebox/resource.h b/modules/rostests/win32/user32/messagebox/resource.h index 6e6ee36e09..f914328d68 100644 --- a/modules/rostests/win32/user32/messagebox/resource.h +++ b/modules/rostests/win32/user32/messagebox/resource.h @@ -1,2 +1,2 @@ -#define IDS_RES_CAPTION 101 -#define IDS_RES_MESSAGE 102 +#define IDS_RES_CAPTION 101 +#define IDS_RES_MESSAGE 102