user32: use internal function to find the default button

André Hentschel nerv at dawncrow.de
Tue Jul 6 14:13:22 CDT 2010


this is more reliable as it recurses into WS_EX_CONTROLPARENT controls and has some more checks.
---
 dlls/user32/controls.h |    1 +
 dlls/user32/defdlg.c   |    2 +-
 dlls/user32/dialog.c   |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index f6653fd..52c899a 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -242,5 +242,6 @@ typedef struct tagDIALOGINFO
 
 extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) DECLSPEC_HIDDEN;
 extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner ) DECLSPEC_HIDDEN;
+extern HWND DEFDLG_FindDefButton( HWND hwndDlg ) DECLSPEC_HIDDEN;
 
 #endif  /* __WINE_CONTROLS_H */
diff --git a/dlls/user32/defdlg.c b/dlls/user32/defdlg.c
index fecd417..1cdd19a 100644
--- a/dlls/user32/defdlg.c
+++ b/dlls/user32/defdlg.c
@@ -109,7 +109,7 @@ static void DEFDLG_RestoreFocus( HWND hwnd )
  *
  * Find the current default push-button.
  */
-static HWND DEFDLG_FindDefButton( HWND hwndDlg )
+HWND DEFDLG_FindDefButton( HWND hwndDlg )
 {
     HWND hwndChild, hwndTmp;
 
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index aac8a4d..55500c4 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -1220,7 +1220,7 @@ 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));
+                    HWND hwndDef = DEFDLG_FindDefButton(hwndDlg);
                     if (!hwndDef || !IsWindowEnabled(hwndDef))
                         return TRUE;
                     SendMessageW( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list