Fix the order of initialization steps of the custom file open dialog

Dmitry Timoshkov dmitry at baikal.ru
Thu Aug 21 04:19:47 CDT 2003


Hello,

Maxime Bellenge reported that my recent commdlg changes broke WinHex
(www.winhex.com)

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Some applications depend on the order of initialization steps
    of the custom file open dialog.

--- cvs/hq/wine/dlls/commdlg/filedlg95.c	Tue Jul 29 18:07:41 2003
+++ wine/dlls/commdlg/filedlg95.c	Thu Aug 21 17:56:03 2003
@@ -649,9 +649,9 @@ static void ArrangeCtrlPositions(HWND hw
     /* finally use fixed parent size */
     rectParent.bottom -= help_fixup;
 
-    /* set the size of the child dialog */
-    SetWindowPos(hwndChildDlg, HWND_BOTTOM,
-                 0, 0, rectParent.right, rectParent.bottom, SWP_NOACTIVATE);
+    /* save the size of the parent's client area */
+    rectChild.right = rectParent.right;
+    rectChild.bottom = rectParent.bottom;
 
     /* set the size of the parent dialog */
     AdjustWindowRectEx(&rectParent, GetWindowLongW(hwndParentDlg, GWL_STYLE),
@@ -661,6 +661,10 @@ static void ArrangeCtrlPositions(HWND hw
                  rectParent.right - rectParent.left,
                  rectParent.bottom - rectParent.top,
                  SWP_NOMOVE | SWP_NOZORDER);
+
+    /* set the size of the child dialog */
+    SetWindowPos(hwndChildDlg, HWND_BOTTOM,
+                 0, 0, rectChild.right, rectChild.bottom, SWP_NOACTIVATE);
 }
 
 INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -930,10 +934,12 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND 
      	   CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
 
          FILEDLG95_InitControls(hwnd);
-      	 FILEDLG95_FillControls(hwnd, wParam, lParam);
+
          if (fodInfos->DlgInfos.hwndCustomDlg)
              ArrangeCtrlPositions(fodInfos->DlgInfos.hwndCustomDlg, hwnd,
                  (fodInfos->ofnInfos->Flags & (OFN_HIDEREADONLY | OFN_SHOWHELP)) == OFN_HIDEREADONLY);
+
+      	 FILEDLG95_FillControls(hwnd, wParam, lParam);
 
          SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
          SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE);






More information about the wine-patches mailing list