Nikolay Sivov : user32/msgbox: Fix static control id.
Alexandre Julliard
julliard at winehq.org
Mon May 8 17:21:22 CDT 2017
Module: wine
Branch: master
Commit: 9ee82b9465c33ecf28ca61c4f6cd8434d242fb1c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9ee82b9465c33ecf28ca61c4f6cd8434d242fb1c
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun May 7 17:49:59 2017 +0300
user32/msgbox: Fix static control id.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/msgbox.c | 5 +----
dlls/user32/resources.h | 2 +-
dlls/user32/tests/dialog.c | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c
index 0839f97..d3d11d6 100644
--- a/dlls/user32/msgbox.c
+++ b/dlls/user32/msgbox.c
@@ -28,15 +28,12 @@
#include "winternl.h"
#include "dlgs.h"
#include "user_private.h"
+#include "resources.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dialog);
WINE_DECLARE_DEBUG_CHANNEL(msgbox);
-#define MSGBOX_IDICON stc1
-#define MSGBOX_IDTEXT 100
-#define IDS_ERROR 2
-
struct ThreadWindows
{
UINT numHandles;
diff --git a/dlls/user32/resources.h b/dlls/user32/resources.h
index d9cc9cc..3cb8c48 100644
--- a/dlls/user32/resources.h
+++ b/dlls/user32/resources.h
@@ -26,5 +26,5 @@
#define MDI_IDC_LISTBOX 100
#define IDS_MDI_MOREWINDOWS 13
#define MSGBOX_IDICON stc1
-#define MSGBOX_IDTEXT 100
+#define MSGBOX_IDTEXT 0xffff
#define IDS_ERROR 2
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index a37c678..6b9d704 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1522,6 +1522,47 @@ static void test_timer_message(void)
DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
}
+static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
+{
+ if (code == HCBT_ACTIVATE)
+ {
+ HWND msgbox = (HWND)wParam, msghwnd;
+ char text[64];
+
+ if (msgbox)
+ {
+ text[0] = 0;
+ GetWindowTextA(msgbox, text, sizeof(text));
+ ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
+
+ msghwnd = GetDlgItem(msgbox, 0xffff);
+ ok(msghwnd != NULL, "Expected static control\n");
+
+ text[0] = 0;
+ GetWindowTextA(msghwnd, text, sizeof(text));
+ ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
+
+ SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONDOWN, 0, 0);
+ SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONUP, 0, 0);
+ }
+ }
+
+ return CallNextHookEx(NULL, code, wParam, lParam);
+}
+
+static void test_MessageBox(void)
+{
+ HHOOK hook;
+ int ret;
+
+ hook = SetWindowsHookExA(WH_CBT, msgbox_hook_proc, NULL, GetCurrentThreadId());
+
+ ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
+ ok(ret == IDCANCEL, "got %d\n", ret);
+
+ UnhookWindowsHookEx(hook);
+}
+
START_TEST(dialog)
{
g_hinst = GetModuleHandleA (0);
@@ -1539,4 +1580,5 @@ START_TEST(dialog)
test_MessageBoxFontTest();
test_SaveRestoreFocus();
test_timer_message();
+ test_MessageBox();
}
More information about the wine-cvs
mailing list