Use System DDE topic for wxExecute if no topic found

Try Execute first, then Request


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-09-19 18:23:34 +00:00
parent 91916eeab9
commit 8f5617e6ff
3 changed files with 29 additions and 5 deletions

View File

@@ -424,6 +424,27 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
nameReal = name.BeforeLast(wxT(';'));
}
#if 0
// If we don't know what size icon we're looking for,
// try to find out what's there.
// Unfortunately this doesn't work, because ExtractIconEx
// will scale the icon to the 'desired' size, even if that
// size of icon isn't explicitly stored. So we would have
// to parse the icon file outselves.
if ( desiredWidth == -1 &&
desiredHeight == -1)
{
// Try loading a large icon first
if ( ::ExtractIconEx(nameReal, iconIndex, &hicon, NULL, 1) == 1)
{
}
// Then try loading a small icon
else if ( ::ExtractIconEx(nameReal, iconIndex, NULL, &hicon, 1) == 1)
{
}
}
else
#endif
// were we asked for a large icon?
if ( desiredWidth == ::GetSystemMetrics(SM_CXICON) &&
desiredHeight == ::GetSystemMetrics(SM_CYICON) )

View File

@@ -237,6 +237,9 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const
wxRegKey(wxRegKey::HKCR, strKey + _T("\\Topic")).
QueryValue(_T(""), ddeTopic);
if (ddeTopic.IsEmpty())
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

View File

@@ -453,7 +453,7 @@ static bool wxExecuteDDE(const wxString& ddeServer,
const wxString& ddeTopic,
const wxString& ddeCommand)
{
bool ok;
bool ok = FALSE;
wxDDEClient client;
wxConnectionBase *conn = client.MakeConnection(_T(""),
@@ -470,17 +470,17 @@ static bool wxExecuteDDE(const wxString& ddeServer,
// important ones - like IE and other MS stuff - use
// XTYP_REQUEST!
//
// so we try it first and then the other one if it
// so we try one first and then the other one if it
// failed
{
wxLogNull noErrors;
ok = conn->Request(ddeCommand) != NULL;
ok = conn->Execute(ddeCommand);
}
if ( !ok )
{
// now try execute - but show the errors
ok = conn->Execute(ddeCommand);
// now try request - but show the errors
ok = conn->Request(ddeCommand) != NULL;
}
}