Adjusts struct size if there's an error.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -326,6 +326,26 @@ int wxFileDialog::ShowModal()
|
|||||||
bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
|
bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
|
||||||
: (GetOpenFileName(&of) != 0);
|
: (GetOpenFileName(&of) != 0);
|
||||||
|
|
||||||
|
DWORD errCode = CommDlgExtendedError();
|
||||||
|
|
||||||
|
if (!success && (errCode == CDERR_STRUCTSIZE))
|
||||||
|
{
|
||||||
|
// The struct size has changed so try a smaller or bigger size
|
||||||
|
|
||||||
|
int oldStructSize = of.lStructSize;
|
||||||
|
of.lStructSize = oldStructSize - (sizeof(void *) + 2*sizeof(DWORD));
|
||||||
|
success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
|
||||||
|
: (GetOpenFileName(&of) != 0);
|
||||||
|
errCode = CommDlgExtendedError();
|
||||||
|
|
||||||
|
if (!success && (errCode == CDERR_STRUCTSIZE))
|
||||||
|
{
|
||||||
|
of.lStructSize = oldStructSize + (sizeof(void *) + 2*sizeof(DWORD));
|
||||||
|
success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&of) != 0)
|
||||||
|
: (GetOpenFileName(&of) != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( success )
|
if ( success )
|
||||||
{
|
{
|
||||||
m_fileNames.Empty();
|
m_fileNames.Empty();
|
||||||
|
Reference in New Issue
Block a user