Disable navigation sounds in wxWebViewIE. This brings the backend into line with the other backends. Also add a general method for changing INTERNETFEATURELIST settings.

See #13694

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70499 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton 2012-02-02 20:32:08 +00:00
parent d9c4ffa893
commit 9447a0d6af
2 changed files with 42 additions and 0 deletions

View File

@ -384,6 +384,8 @@ private:
bool CanExecCommand(wxString command) const;
void ExecCommand(wxString command);
IHTMLDocument2* GetDocument() const;
//Toggles control features see INTERNETFEATURELIST for values.
bool EnableControlFeature(long flag, bool enable = true);
wxDECLARE_DYNAMIC_CLASS(wxWebViewIE);
};

View File

@ -87,6 +87,8 @@ bool wxWebViewIE::Create(wxWindow* parent,
m_container = new wxIEContainer(this, IID_IWebBrowser2, m_webBrowser, m_uiHandler);
EnableControlFeature(21 /* FEATURE_DISABLE_NAVIGATION_SOUNDS */);
LoadURL(url);
return true;
}
@ -790,6 +792,44 @@ IHTMLDocument2* wxWebViewIE::GetDocument() const
return document;
}
bool wxWebViewIE::EnableControlFeature(long flag, bool enable)
{
#if wxUSE_DYNLIB_CLASS
wxDynamicLibrary urlMon(wxT("urlmon.dll"));
if( urlMon.IsLoaded() &&
urlMon.HasSymbol("CoInternetSetFeatureEnabled") &&
urlMon.HasSymbol("CoInternetIsFeatureEnabled"))
{
typedef HRESULT (WINAPI *CoInternetSetFeatureEnabled_t)(DWORD, DWORD, BOOL);
typedef HRESULT (WINAPI *CoInternetIsFeatureEnabled_t)(DWORD, DWORD);
wxDYNLIB_FUNCTION(CoInternetSetFeatureEnabled_t, CoInternetSetFeatureEnabled, urlMon);
wxDYNLIB_FUNCTION(CoInternetIsFeatureEnabled_t, CoInternetIsFeatureEnabled, urlMon);
HRESULT hr = (*pfnCoInternetIsFeatureEnabled)(flag,
0x2 /* SET_FEATURE_ON_PROCESS */);
if((hr == S_OK && enable) || (hr == S_FALSE && !enable))
return true;
hr = (*pfnCoInternetSetFeatureEnabled)(flag,
0x2/* SET_FEATURE_ON_PROCESS */,
(enable ? TRUE : FALSE));
if ( FAILED(hr) )
{
wxLogApiError(wxT("CoInternetSetFeatureEnabled"), hr);
return false;
}
return true;
}
return false;
#else
wxUnusedVar(flag);
wxUnusedVar(enable);
return false;
#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
}
void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
{
if (m_webBrowser == NULL) return;