+void wxFileDialog::DoGetPosition(int *x, int *y) const
+{
+ if ( x )
+ *x = gs_rectDialog.x;
+ if ( y )
+ *y = gs_rectDialog.y;
+}
+
+
+void wxFileDialog::DoGetSize(int *width, int *height) const
+{
+ if ( width )
+ *width = gs_rectDialog.width;
+ if ( height )
+ *height = gs_rectDialog.height;
+}
+
+void wxFileDialog::DoMoveWindow(int x, int y, int WXUNUSED(w), int WXUNUSED(h))
+{
+ m_bMovedWindow = true;
+
+ gs_rectDialog.x = x;
+ gs_rectDialog.y = y;
+
+ // size of the dialog can't be changed because the controls are not laid
+ // out correctly then
+}
+
+// helper used below in ShowModal(): style is used to determine whether to show
+// the "Save file" dialog (if it contains wxFD_SAVE bit) or "Open file" one;
+// returns true on success or false on failure in which case err is filled with
+// the CDERR_XXX constant
+static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
+{
+ if ( style & wxFD_SAVE ? GetSaveFileName(of) : GetOpenFileName(of) )
+ return true;
+
+ if ( err )
+ {
+#ifdef __WXWINCE__
+ // according to MSDN, CommDlgExtendedError() should work under CE as
+ // well but apparently in practice it doesn't (anybody has more
+ // details?)
+ *err = GetLastError();
+#else
+ *err = CommDlgExtendedError();
+#endif
+ }
+
+ return false;
+}
+
+// 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 nor under Win64, however, as there are no
+// compilers with old headers for these architectures
+#if defined(__WXWINCE__) || defined(__WIN64__)
+ typedef OPENFILENAME wxOPENFILENAME;
+
+ 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
+ void *pVoid;
+ DWORD dw1;
+ DWORD dw2;
+ };
+
+ // hardcoded sizeof(OPENFILENAME) in the Platform SDK: we have to do it
+ // because sizeof(OPENFILENAME) in the headers we use when compiling the
+ // library could be less if _WIN32_WINNT is not >= 0x500
+ static const DWORD wxOPENFILENAME_V5_SIZE = 88;
+
+ // this is hardcoded sizeof(OPENFILENAME_NT4) from Platform SDK
+ static const DWORD wxOPENFILENAME_V4_SIZE = 76;
+
+ // always try the new one first
+ static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE;
+#endif // __WXWINCE__ || __WIN64__/!...
+