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
This commit is contained in:
Vadim Zeitlin
2013-08-07 11:08:12 +00:00
parent ccef4c3ad1
commit 777469ca93
2 changed files with 20 additions and 14 deletions

View File

@@ -574,6 +574,7 @@ All (GUI):
wxMSW: wxMSW:
- It is now possible to tab into radio boxes again. - It is now possible to tab into radio boxes again.
- Fix launching some types of files under Windows 7 and later (Steven Houchins).
wxOSX: wxOSX:

View File

@@ -291,23 +291,28 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
if ( keyDDE.Open(wxRegKey::Read) ) { if ( keyDDE.Open(wxRegKey::Read) ) {
wxString ddeCommand, ddeServer, ddeTopic; wxString ddeCommand, ddeServer, ddeTopic;
keyDDE.QueryValue(wxEmptyString, ddeCommand); keyDDE.QueryValue(wxEmptyString, ddeCommand);
ddeCommand.Replace(wxT("%1"), wxT("%s"));
wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application")); // in some cases "DDEExec" subkey exists but has no value, we
keyServer.QueryValue(wxEmptyString, ddeServer); // shouldn't use DDE in this case
wxRegKey keyTopic(wxRegKey::HKCR, strKey + wxT("\\Topic")); if ( !ddeCommand.empty() ) {
keyTopic.QueryValue(wxEmptyString, ddeTopic); ddeCommand.Replace(wxT("%1"), wxT("%s"));
if (ddeTopic.empty()) wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application"));
ddeTopic = wxT("System"); keyServer.QueryValue(wxEmptyString, ddeServer);
wxRegKey keyTopic(wxRegKey::HKCR, strKey + wxT("\\Topic"));
keyTopic.QueryValue(wxEmptyString, ddeTopic);
// HACK: we use a special feature of wxExecute which exists if (ddeTopic.empty())
// just because we need it here: it will establish DDE ddeTopic = wxT("System");
// conversation with the program it just launched
command.Prepend(wxT("WX_DDE#")); // HACK: we use a special feature of wxExecute which exists
command << wxT('#') << ddeServer // just because we need it here: it will establish DDE
<< wxT('#') << ddeTopic // conversation with the program it just launched
<< wxT('#') << ddeCommand; command.Prepend(wxT("WX_DDE#"));
command << wxT('#') << ddeServer
<< wxT('#') << ddeTopic
<< wxT('#') << ddeCommand;
}
} }
else else
#endif // wxUSE_IPC #endif // wxUSE_IPC