Commit 00442ba5 authored by Adrian Thurston's avatar Adrian Thurston Committed by Alexandre Julliard

Protect against wrong return value from WM_INITDIALOG.

parent be5753d3
......@@ -771,12 +771,22 @@ HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
if (DIALOG_CreateControls( wndPtr, dlgTemplate, &template,
hInst, win32Template ))
{
/* Send initialisation messages and set focus */
HWND hwndPreInitFocus;
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
hwndPreInitFocus = GetFocus();
if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
SetFocus( dlgInfo->hwndFocus );
else
{
/* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
but the focus has not changed, set the focus where we expect it. */
if ( GetFocus() == hwndPreInitFocus )
SetFocus( dlgInfo->hwndFocus );
}
if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
{
......
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