Commit 9ee82b94 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32/msgbox: Fix static control id.

parent 36b7d6f5
...@@ -28,15 +28,12 @@ ...@@ -28,15 +28,12 @@
#include "winternl.h" #include "winternl.h"
#include "dlgs.h" #include "dlgs.h"
#include "user_private.h" #include "user_private.h"
#include "resources.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dialog); WINE_DEFAULT_DEBUG_CHANNEL(dialog);
WINE_DECLARE_DEBUG_CHANNEL(msgbox); WINE_DECLARE_DEBUG_CHANNEL(msgbox);
#define MSGBOX_IDICON stc1
#define MSGBOX_IDTEXT 100
#define IDS_ERROR 2
struct ThreadWindows struct ThreadWindows
{ {
UINT numHandles; UINT numHandles;
......
...@@ -26,5 +26,5 @@ ...@@ -26,5 +26,5 @@
#define MDI_IDC_LISTBOX 100 #define MDI_IDC_LISTBOX 100
#define IDS_MDI_MOREWINDOWS 13 #define IDS_MDI_MOREWINDOWS 13
#define MSGBOX_IDICON stc1 #define MSGBOX_IDICON stc1
#define MSGBOX_IDTEXT 100 #define MSGBOX_IDTEXT 0xffff
#define IDS_ERROR 2 #define IDS_ERROR 2
...@@ -1522,6 +1522,47 @@ static void test_timer_message(void) ...@@ -1522,6 +1522,47 @@ static void test_timer_message(void)
DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc); 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) START_TEST(dialog)
{ {
g_hinst = GetModuleHandleA (0); g_hinst = GetModuleHandleA (0);
...@@ -1539,4 +1580,5 @@ START_TEST(dialog) ...@@ -1539,4 +1580,5 @@ START_TEST(dialog)
test_MessageBoxFontTest(); test_MessageBoxFontTest();
test_SaveRestoreFocus(); test_SaveRestoreFocus();
test_timer_message(); test_timer_message();
test_MessageBox();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment