Fixed wxFileDialog breakage on WinCE due to incorrect structure size, and
added correct error testing for WinCE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,6 +61,7 @@ wxWinCE:
|
|||||||
- All wxTopLevelWindows resizes accordingly to SIP visibility.
|
- All wxTopLevelWindows resizes accordingly to SIP visibility.
|
||||||
- ::wxGetUserName() implemented.
|
- ::wxGetUserName() implemented.
|
||||||
- wxDisplay enumeration support.
|
- wxDisplay enumeration support.
|
||||||
|
- Fixed wxFileDialog breakage on WinCE due to incorrect structure size.
|
||||||
|
|
||||||
Unix:
|
Unix:
|
||||||
|
|
||||||
|
@@ -276,7 +276,7 @@ int wxFileDialog::ShowModal()
|
|||||||
// comcdlg32.dll, but as we don't use the extended fields anyhow, set
|
// comcdlg32.dll, but as we don't use the extended fields anyhow, set
|
||||||
// the struct size to the old value - otherwise, the programs compiled
|
// the struct size to the old value - otherwise, the programs compiled
|
||||||
// with new headers will not work with the old libraries
|
// with new headers will not work with the old libraries
|
||||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
|
#if !defined(__WXWINCE__) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
|
||||||
of.lStructSize = sizeof(OPENFILENAME) -
|
of.lStructSize = sizeof(OPENFILENAME) -
|
||||||
(sizeof(void *) + 2*sizeof(DWORD));
|
(sizeof(void *) + 2*sizeof(DWORD));
|
||||||
#else // old headers
|
#else // old headers
|
||||||
@@ -396,6 +396,11 @@ int wxFileDialog::ShowModal()
|
|||||||
bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)
|
bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)
|
||||||
: GetOpenFileName(&of)) != 0;
|
: GetOpenFileName(&of)) != 0;
|
||||||
|
|
||||||
|
#ifdef __WXWINCE__
|
||||||
|
DWORD errCode = GetLastError();
|
||||||
|
#else
|
||||||
|
DWORD errCode = CommDlgExtendedError();
|
||||||
|
|
||||||
DWORD errCode = CommDlgExtendedError();
|
DWORD errCode = CommDlgExtendedError();
|
||||||
|
|
||||||
// GetOpenFileName will always change the current working directory on
|
// GetOpenFileName will always change the current working directory on
|
||||||
@@ -430,6 +435,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
|
#endif // __WXWINCE__
|
||||||
|
|
||||||
if ( success )
|
if ( success )
|
||||||
{
|
{
|
||||||
@@ -503,6 +509,28 @@ int wxFileDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
// common dialog failed - why?
|
// common dialog failed - why?
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
#ifdef __WXWINCE__
|
||||||
|
if (errCode == 0)
|
||||||
|
{
|
||||||
|
// OK, user cancelled the dialog
|
||||||
|
}
|
||||||
|
else if (errCode == ERROR_INVALID_PARAMETER)
|
||||||
|
{
|
||||||
|
wxLogError(wxT("Invalid parameter passed to file dialog function."));
|
||||||
|
}
|
||||||
|
else if (errCode == ERROR_OUTOFMEMORY)
|
||||||
|
{
|
||||||
|
wxLogError(wxT("Out of memory when calling file dialog function."));
|
||||||
|
}
|
||||||
|
else if (errCode == ERROR_CALL_NOT_IMPLEMENTED)
|
||||||
|
{
|
||||||
|
wxLogError(wxT("Call not implemented when calling file dialog function."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError(wxT("Unknown error %d when calling file dialog function."), errCode);
|
||||||
|
}
|
||||||
|
#else
|
||||||
DWORD dwErr = CommDlgExtendedError();
|
DWORD dwErr = CommDlgExtendedError();
|
||||||
if ( dwErr != 0 )
|
if ( dwErr != 0 )
|
||||||
{
|
{
|
||||||
@@ -511,6 +539,7 @@ int wxFileDialog::ShowModal()
|
|||||||
dwErr);
|
dwErr);
|
||||||
}
|
}
|
||||||
//else: it was just cancelled
|
//else: it was just cancelled
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user