How do I remove the click transition sounds in TWebBrowser?
Please tell me how to remove the sounds of clicks from page to page in TWebBrowser
?
2 answers
Note the procedure CoInternetSetFeatureEnabled
in URLMON.DLL.
It allows you to set some Feature Controls on the fly.
You can read about it here: CoInternetSetFeatureEnabled function (Windows)
The list of Feature Controls can be found here: Introduction to Feature Controls (Windows)
From this list, you are interested in the FEATURE_DISABLE_NAVIGATION_SOUNDS
option.
Enabling this option for the app will allow you to achieve the desired effect.
Quiet Navigation (FEATURE_DISABLE_NAVIGATION_SOUNDS) - This control disables the sound that is produced when clicking on links.
It will look something like this:
HRESULT hr = CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, TRUE);
Full code example:
unit untUrlMon;
implementation
uses
Windows;
function CoInternetSetFeatureEnabled(FeatureEntry: DWORD; dwFlags: DWORD; fEnable: BOOL): HRESULT; stdcall; external 'urlmon.dll';
initialization
CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, True);
end.
Compiled from the following responses to StackOveflow: