Commit 592d994f authored by Vladimir Panteleev's avatar Vladimir Panteleev Committed by Alexandre Julliard

user32: Fix VK_RETURN handling in IsDialogMessage for dialogs without an IDOK.

parent fe0df211
......@@ -1221,10 +1221,8 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
else if (DC_HASDEFID == HIWORD(dw = SendMessageW (hwndDlg, DM_GETDEFID, 0, 0)))
{
HWND hwndDef = GetDlgItem(hwndDlg, LOWORD(dw));
if (!hwndDef || !IsWindowEnabled(hwndDef))
return TRUE;
SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
(LPARAM)GetDlgItem(hwndDlg, LOWORD(dw)));
if (hwndDef ? IsWindowEnabled(hwndDef) : LOWORD(dw)==IDOK)
SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ), (LPARAM)hwndDef);
}
else
{
......
......@@ -1000,6 +1000,28 @@ static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg,
return FALSE;
}
static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg,
WPARAM wParam, LPARAM lParam)
{
static int received_idok = 0;
switch (uiMsg)
{
case WM_INITDIALOG:
{
MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
IsDialogMessage(hDlg, &msg);
}
ok(received_idok, "WM_COMMAND not received\n");
EndDialog(hDlg, 0);
return TRUE;
case WM_COMMAND:
ok(wParam==IDOK, "Expected IDOK\n");
received_idok = 1;
return TRUE;
}
return FALSE;
}
static void test_DialogBoxParamA(void)
{
INT_PTR ret;
......@@ -1044,6 +1066,8 @@ static void test_DialogBoxParamA(void)
ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
ok(ret == IDOK, "Expected IDOK\n");
DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
}
static void test_DisabledDialogTest(void)
......
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