[ROSTESTS] Add a test for the MB_SERVICE_NOTIFICATION flag of the MessageBox*() APIs.

This commit is contained in:
Hermès Bélusca-Maïto 2018-08-17 21:46:50 +02:00
parent f8f08f3e9b
commit c035f4648b
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 34 additions and 9 deletions

View file

@ -1,7 +1,8 @@
/* /*
* PROJECT: ReactOS Tests * PROJECT: ReactOS Tests
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) * 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 * COPYRIGHT: Copyright 2018 Hermes Belusca-Maito
*/ */
@ -63,16 +64,16 @@ C_ASSERT(sizeof(MSGBOXDATA) == 0x4C);
#endif #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 // Example taken from http://rsdn.org/forum/winapi/3273168.1
// See also http://www.vbforums.com/showthread.php?840593-Message-Box-with-Four-Buttons // 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; MSGBOXDATA data;
int res = 0; int res = 0;
@ -113,8 +114,32 @@ int wmain(int argc, WCHAR* argv[])
else else
{ {
res = SoftModalMessageBox(&data); 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"); printf("Press any key to quit...\n");
_getch(); _getch();

View file

@ -1,2 +1,2 @@
#define IDS_RES_CAPTION 101 #define IDS_RES_CAPTION 101
#define IDS_RES_MESSAGE 102 #define IDS_RES_MESSAGE 102