Avoid spurious errors from wxFileType::GetCommand() under Windows XP too.

This problem was already fixed in r77649 for Windows 7 (and hopefully all the
other supported Windows versions), but it turns out that XP returns a
different error when the association is not found in the registry, so the
debug error message was still given under it.

Fix this by checking for both ERROR_NO_ASSOCIATION and ERROR_FILE_NOT_FOUND.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-10-19 14:16:22 +00:00
parent cf8700162d
commit e1b09f3b5d

View File

@@ -267,9 +267,15 @@ wxString wxAssocQueryString(ASSOCSTR assoc,
if ( hr != S_OK )
{
// The only really expected error here is that no association is
// defined, anything else is not expected.
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) )
// defined, anything else is not expected. The confusing thing is that
// different errors are returned for this expected error under
// different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
// returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
{
wxLogApiError("AssocQueryString", hr);
}
return wxString();
}