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:
Julian Smart
2005-12-14 11:20:09 +00:00
parent 1fc8cfbd81
commit e8615999dd
2 changed files with 31 additions and 1 deletions

View File

@@ -61,6 +61,7 @@ wxWinCE:
- All wxTopLevelWindows resizes accordingly to SIP visibility.
- ::wxGetUserName() implemented.
- wxDisplay enumeration support.
- Fixed wxFileDialog breakage on WinCE due to incorrect structure size.
Unix:

View File

@@ -276,7 +276,7 @@ int wxFileDialog::ShowModal()
// comcdlg32.dll, but as we don't use the extended fields anyhow, set
// the struct size to the old value - otherwise, the programs compiled
// 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) -
(sizeof(void *) + 2*sizeof(DWORD));
#else // old headers
@@ -396,6 +396,11 @@ int wxFileDialog::ShowModal()
bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)
: GetOpenFileName(&of)) != 0;
#ifdef __WXWINCE__
DWORD errCode = GetLastError();
#else
DWORD errCode = CommDlgExtendedError();
DWORD errCode = CommDlgExtendedError();
// GetOpenFileName will always change the current working directory on
@@ -430,6 +435,7 @@ int wxFileDialog::ShowModal()
}
}
#endif // __WIN32__
#endif // __WXWINCE__
if ( success )
{
@@ -503,6 +509,28 @@ int wxFileDialog::ShowModal()
{
// common dialog failed - why?
#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();
if ( dwErr != 0 )
{
@@ -511,6 +539,7 @@ int wxFileDialog::ShowModal()
dwErr);
}
//else: it was just cancelled
#endif
#endif
}