When searching for the DEFPUSHBUTTON in a dialog, recurse into child
authorZach Gorman <zach@archetypeauction.com>
Thu, 19 Aug 2004 01:03:12 +0000 (01:03 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 19 Aug 2004 01:03:12 +0000 (01:03 +0000)
windows with the WS_EX_CONTROLPARENT style (if they are visible and
enabled).

windows/defdlg.c

index def5b8a..e6b1da8 100644 (file)
@@ -115,11 +115,22 @@ static void DEFDLG_RestoreFocus( HWND hwnd )
  */
 static HWND DEFDLG_FindDefButton( HWND hwndDlg )
 {
-    HWND hwndChild = GetWindow( hwndDlg, GW_CHILD );
+    HWND hwndChild, hwndTmp;
+
+    hwndChild = GetWindow( hwndDlg, GW_CHILD );
     while (hwndChild)
     {
         if (SendMessageW( hwndChild, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
             break;
+
+        /* Recurse into WS_EX_CONTROLPARENT controls */
+        if (GetWindowLongA( hwndChild, GWL_EXSTYLE ) & WS_EX_CONTROLPARENT)
+        {
+            LONG dsStyle = GetWindowLongA( hwndChild, GWL_STYLE );
+            if ((dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED) &&
+                (hwndTmp = DEFDLG_FindDefButton(hwndChild)) != NULL)
+           return hwndTmp;
+        }
         hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
     }
     return hwndChild;