fix for Win64 after last sizeof(OPENFILENAME) change
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -229,20 +229,20 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basically, the problem is that we need to use the "new" size of the
|
// We want to use OPENFILENAME struct version 5 (Windows 2000/XP) but we don't
|
||||||
// OPENFILENAME structure
|
// know if the OPENFILENAME declared in the currently used headers is a V5 or
|
||||||
// (OPENFILENAME_SIZE_VERSION_400 + void* + DWORD + DWORD)
|
// V4 (smaller) one so we try to manually extend the struct in case it is the
|
||||||
// in Windows 2000 and XP so that the new-style file dialog with the
|
// old one.
|
||||||
// "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 don't do this on Windows CE, however.
|
// We don't do this on Windows CE nor under Win64, however, as there are no
|
||||||
#ifdef __WXWINCE__
|
// 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);
|
static const DWORD gs_ofStructSize = sizeof(OPENFILENAME);
|
||||||
#else // !__WXWINCE__
|
#else // !__WXWINCE__ || __WIN64__
|
||||||
|
#define wxTRY_SMALLER_OPENFILENAME
|
||||||
|
|
||||||
struct wxOPENFILENAME : public OPENFILENAME
|
struct wxOPENFILENAME : public OPENFILENAME
|
||||||
{
|
{
|
||||||
// fields added in Windows 2000/XP comdlg32.dll version
|
// fields added in Windows 2000/XP comdlg32.dll version
|
||||||
@@ -258,10 +258,10 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
|
|||||||
|
|
||||||
// this is hardcoded sizeof(OPENFILENAME_NT4) from Platform SDK
|
// this is hardcoded sizeof(OPENFILENAME_NT4) from Platform SDK
|
||||||
static const DWORD wxOPENFILENAME_V4_SIZE = 76;
|
static const DWORD wxOPENFILENAME_V4_SIZE = 76;
|
||||||
#endif // __WXWINCE__/!__WXWINCE__
|
|
||||||
|
|
||||||
// always try the new one first
|
// always try the new one first
|
||||||
static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE;
|
static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE;
|
||||||
|
#endif // __WXWINCE__ || __WIN64__/!...
|
||||||
|
|
||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
@@ -438,7 +438,7 @@ int wxFileDialog::ShowModal()
|
|||||||
DWORD errCode;
|
DWORD errCode;
|
||||||
bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
|
bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
|
||||||
|
|
||||||
#ifndef __WXWINCE__
|
#ifdef wxTRY_SMALLER_OPENFILENAME
|
||||||
// the system might be too old to support the new version file dialog
|
// the system might be too old to support the new version file dialog
|
||||||
// boxes, try with the old size
|
// boxes, try with the old size
|
||||||
if ( !success && errCode == CDERR_STRUCTSIZE &&
|
if ( !success && errCode == CDERR_STRUCTSIZE &&
|
||||||
@@ -454,7 +454,7 @@ int wxFileDialog::ShowModal()
|
|||||||
gs_ofStructSize = of.lStructSize;
|
gs_ofStructSize = of.lStructSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !__WXWINCE__
|
#endif // wxTRY_SMALLER_OPENFILENAME
|
||||||
|
|
||||||
if ( success )
|
if ( success )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user