git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38873 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
-// Basically, the problem is that we need to use the "new" size of the
-// OPENFILENAME structure
-// (OPENFILENAME_SIZE_VERSION_400 + void* + DWORD + DWORD)
-// in Windows 2000 and XP so that the new-style file dialog with the
-// "Places Bar" shows up. Unfortunately, there seems to be no reliable way
-// to test for it in the headers, so we need to always make one
-// with the extra bytes.
+// We want to use OPENFILENAME struct version 5 (Windows 2000/XP) but we don't
+// know if the OPENFILENAME declared in the currently used headers is a V5 or
+// V4 (smaller) one so we try to manually extend the struct in case it is the
+// old one.
-// We don't do this on Windows CE, however.
-#ifdef __WXWINCE__
+// We don't do this on Windows CE nor under Win64, however, as there are no
+// compilers with old headers for these architectures
+#if defined(__WXWINCE__) || defined(__WIN64__)
     typedef OPENFILENAME wxOPENFILENAME;
 
     typedef OPENFILENAME wxOPENFILENAME;
 
-    static const DWORD wxOPENFILENAME_V5_SIZE = sizeof(OPENFILENAME);
-#else // !__WXWINCE__
+    static const DWORD gs_ofStructSize = sizeof(OPENFILENAME);
+#else // !__WXWINCE__ || __WIN64__
+    #define wxTRY_SMALLER_OPENFILENAME
+
     struct wxOPENFILENAME : public OPENFILENAME
     {
         // fields added in Windows 2000/XP comdlg32.dll version
     struct wxOPENFILENAME : public OPENFILENAME
     {
         // fields added in Windows 2000/XP comdlg32.dll version
 
     // this is hardcoded sizeof(OPENFILENAME_NT4) from Platform SDK
     static const DWORD wxOPENFILENAME_V4_SIZE = 76;
 
     // this is hardcoded sizeof(OPENFILENAME_NT4) from Platform SDK
     static const DWORD wxOPENFILENAME_V4_SIZE = 76;
-#endif // __WXWINCE__/!__WXWINCE__
-// always try the new one first
-static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE;
+    // always try the new one first
+    static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE;
+#endif // __WXWINCE__ || __WIN64__/!...
 
 int wxFileDialog::ShowModal()
 {
 
 int wxFileDialog::ShowModal()
 {
     DWORD errCode;
     bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
 
     DWORD errCode;
     bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
 
+#ifdef wxTRY_SMALLER_OPENFILENAME
     // the system might be too old to support the new version file dialog
     // boxes, try with the old size
     if ( !success && errCode == CDERR_STRUCTSIZE &&
     // the system might be too old to support the new version file dialog
     // boxes, try with the old size
     if ( !success && errCode == CDERR_STRUCTSIZE &&
             gs_ofStructSize = of.lStructSize;
         }
     }
             gs_ofStructSize = of.lStructSize;
         }
     }
+#endif // wxTRY_SMALLER_OPENFILENAME