From 4eeedf2f9eabe1d41ea2f2a7c0fbc53fc0c16252 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sat, 8 Dec 2007 18:11:28 +0000 Subject: [PATCH] Dmitry Timoshkov : Windows doesn' t send the initialization messages to a dialog if a passed in dlgProc is NULL . svn path=/trunk/; revision=31087 --- reactos/dll/win32/user32/windows/dialog.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reactos/dll/win32/user32/windows/dialog.c b/reactos/dll/win32/user32/windows/dialog.c index 38b1c37a60d..6944fa3d8d9 100644 --- a/reactos/dll/win32/user32/windows/dialog.c +++ b/reactos/dll/win32/user32/windows/dialog.c @@ -798,7 +798,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, if (unicode) SetWindowLongPtrW( hwnd, DWLP_DLGPROC, (ULONG_PTR)dlgProc ); else SetWindowLongPtrA( hwnd, DWLP_DLGPROC, (ULONG_PTR)dlgProc ); - if (dlgInfo->hUserFont) + if (dlgProc && dlgInfo->hUserFont) SendMessageW( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 ); /* Create controls */ @@ -806,16 +806,17 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode )) { /* Send initialisation messages and set focus */ - - if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ) && - ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE))) + if (dlgProc) { - /* By returning TRUE, app has requested a default focus assignment */ - dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE); - if( dlgInfo->hwndFocus ) - SetFocus( dlgInfo->hwndFocus ); + if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ) && + ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE))) + { + /* By returning TRUE, app has requested a default focus assignment */ + dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE); + if( dlgInfo->hwndFocus ) + SetFocus( dlgInfo->hwndFocus ); + } } - if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)) SendMessageW( hwnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, 0), 0);