From: Vadim Zeitlin Date: Wed, 7 Aug 2013 11:08:12 +0000 (+0000) Subject: Don't use DDEExec registry key in wxMSW wxExecute() if it's empty. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/777469ca936965a1ed15f70f3fe81f665833bf6a?ds=sidebyside Don't use DDEExec registry key in wxMSW wxExecute() if it's empty. Some file types have DDEExec subkey in the registry but no value for it, don't use DDE for launching the files of these types in this case as this only results in errors. Closes #15388. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 26672a0686..b500425edd 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -574,6 +574,7 @@ All (GUI): wxMSW: - It is now possible to tab into radio boxes again. +- Fix launching some types of files under Windows 7 and later (Steven Houchins). wxOSX: diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index 658540b995..9bd56ad436 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -291,23 +291,28 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const if ( keyDDE.Open(wxRegKey::Read) ) { wxString ddeCommand, ddeServer, ddeTopic; keyDDE.QueryValue(wxEmptyString, ddeCommand); - ddeCommand.Replace(wxT("%1"), wxT("%s")); - - wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application")); - keyServer.QueryValue(wxEmptyString, ddeServer); - wxRegKey keyTopic(wxRegKey::HKCR, strKey + wxT("\\Topic")); - keyTopic.QueryValue(wxEmptyString, ddeTopic); - - if (ddeTopic.empty()) - ddeTopic = wxT("System"); - - // HACK: we use a special feature of wxExecute which exists - // just because we need it here: it will establish DDE - // conversation with the program it just launched - command.Prepend(wxT("WX_DDE#")); - command << wxT('#') << ddeServer - << wxT('#') << ddeTopic - << wxT('#') << ddeCommand; + + // in some cases "DDEExec" subkey exists but has no value, we + // shouldn't use DDE in this case + if ( !ddeCommand.empty() ) { + ddeCommand.Replace(wxT("%1"), wxT("%s")); + + wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application")); + keyServer.QueryValue(wxEmptyString, ddeServer); + wxRegKey keyTopic(wxRegKey::HKCR, strKey + wxT("\\Topic")); + keyTopic.QueryValue(wxEmptyString, ddeTopic); + + if (ddeTopic.empty()) + ddeTopic = wxT("System"); + + // HACK: we use a special feature of wxExecute which exists + // just because we need it here: it will establish DDE + // conversation with the program it just launched + command.Prepend(wxT("WX_DDE#")); + command << wxT('#') << ddeServer + << wxT('#') << ddeTopic + << wxT('#') << ddeCommand; + } } else #endif // wxUSE_IPC