Re: user32: Fix VK_RETURN handling in IsDialogMessage for dialogs without an IDOK
Vladimir Panteleev <thecybershadow(a)gmail.com> wrote:
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index aac8a4d..ee99710 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -1221,6 +1221,11 @@ 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 && LOWORD(dw)==IDOK) + { + SendMessageW( hwndDlg, WM_COMMAND, IDOK, 0 ); + return TRUE; + } if (!hwndDef || !IsWindowEnabled(hwndDef)) return TRUE; SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
It would be cleaner to use an existing SendMessage() instead of introducing a duplicate. -- Dmitry.
Hello Dmitry, Wednesday, September 15, 2010, 10:35:20 AM, you wrote:
It would be cleaner to use an existing SendMessage() instead of introducing a duplicate.
How does this look? I took the opportunity to remove the duplicate "GetDlgItem(hwndDlg, LOWORD(dw))". -- Best regards, Vladimir mailto:thecybershadow(a)gmail.com
Vladimir Panteleev <thecybershadow(a)gmail.com> wrote:
How does this look? I took the opportunity to remove the duplicate "GetDlgItem(hwndDlg, LOWORD(dw))".
It's better, but since BN_CLICKED is 0, there is no need to introduce wParam. -- Dmitry.
Hello Dmitry, Wednesday, September 15, 2010, 11:30:38 AM, you wrote:
It's better, but since BN_CLICKED is 0, there is no need to introduce wParam.
I reduced the patch to two lines (it's not visible from the context, but there's a "return TRUE" lower to make up for the removed one). Hopefully it's not too cryptic now. Thanks for the feedback. -- Best regards, Vladimir mailto:thecybershadow(a)gmail.com
Vladimir Panteleev <thecybershadow(a)gmail.com> wrote:
I reduced the patch to two lines (it's not visible from the context, but there's a "return TRUE" lower to make up for the removed one). Hopefully it's not too cryptic now. Thanks for the feedback.
Looks good to me. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Vladimir Panteleev