From 6f6dd276a801247045a9684b86b47d9d9d9a1979 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Oct 2006 01:01:13 +0000 Subject: [PATCH] try http scheme if we can't find the default browser for the URL scheme (this is the case for file:// URLs for example) in wxLaunchDefaultBrowser() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/utilscmn.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 6a37b6ec9b..d06002274f 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -729,7 +729,8 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags) // set the scheme of url to http if it does not have one // RR: This doesn't work if the url is just a local path wxString url(urlOrig); - if ( !wxURI(url).HasScheme() ) + wxURI uri(url); + if ( !uri.HasScheme() ) url.Prepend(wxT("http://")); @@ -740,7 +741,13 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags) { // ShellExecuteEx() opens the URL in an existing window by default so // we can't use it if we need a new window - wxRegKey key(wxRegKey::HKCR, url.BeforeFirst(':') + _T("\\shell\\open")); + wxRegKey key(wxRegKey::HKCR, uri.GetScheme() + _T("\\shell\\open")); + if ( !key.Exists() ) + { + // try default browser, it must be registered at least for http URLs + key.SetName(wxRegKey::HKCR, _T("http\\shell\\open")); + } + if ( key.Exists() ) { wxRegKey keyDDE(key, wxT("DDEExec")); -- 2.45.2