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

This commit is contained in:
Vladimir Panteleev 2010-09-14 16:46:55 +03:00 committed by Alexandre Julliard
parent fe0df211a1
commit 592d994f00
2 changed files with 26 additions and 4 deletions

View File

@ -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
{

View File

@ -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)