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:
Julian Smart
2000-06-08 12:06:08 +00:00
parent eb5ad261fd
commit 551a706062

View File

@@ -326,6 +326,26 @@ int wxFileDialog::ShowModal()
bool success = (m_dialogStyle & wxSAVE) ? (GetSaveFileName(&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 )
{
m_fileNames.Empty();