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

@@ -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);
// 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"));
if (ddeTopic.empty())
ddeTopic = wxT("System");
wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application"));
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
// 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;
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