hi al,
i have a webbrowser component that refreshes every 5 sec, but when it refreshes you hear the *click* sound. But how do i disable that

Dani AI

Generated

reported a WebBrowser that refreshes every 5 seconds and makes the familiar “click” on each refresh. pointed to a resource and showed the registry approach (which is effective), but that changes the global Windows navigation sound mapping and therefore affects other apps and users of the PC. (superuser.com)

App-only (recommended for apps): call the URL moniker feature control to disable navigation sounds for the current process only (available since IE7). This avoids system-wide changes and is safe to call early (before heavy navigation). Example VB.NET P/Invoke (call at startup, before creating/navigating the WebBrowser control):

Imports System.Runtime.InteropServices

Public Class NativeMethods
    <DllImport("urlmon.dll")>
    Public Shared Function CoInternetSetFeatureEnabled(featureEntry As Integer, dwFlags As Integer, fEnable As Boolean) As Integer
    End Function

    Public Const FEATURE_DISABLE_NAVIGATION_SOUNDS As Integer = 21
    Public Const SET_FEATURE_ON_PROCESS As Integer = &H2
End Class

' Example usage:
NativeMethods.CoInternetSetFeatureEnabled(NativeMethods.FEATURE_DISABLE_NAVIGATION_SOUNDS, NativeMethods.SET_FEATURE_ON_PROCESS, True)

This API is documented by Microsoft. (learn.microsoft.com)

Alternative (no global settings): avoid triggering the navigation sound by not performing a full navigation. Update the DOM instead of reloading — use Document.Write/OpenNew or modify DomDocument.Body.InnerHTML to refresh content. OpenNew can steal focus in some cases; updating InnerHTML is usually the least disruptive option. Example patterns are described in community writeups. ()

Non-programmatic options: stop the sound from the Windows Sound control (Change system sounds → Windows Explorer / Start Navigation → (None)), or edit the per-user AppEvents mapping in the registry (backup first) — registry edits are effective but system-wide and riskier. For new projects, consider migrating from the legacy WebBrowser/IE engine to WebView2 (Edge Chromium) which avoids many IE-era quirks. (howtogeek.com)

Summary: the cleanest app-local fix is the feature-control API (CoInternetSetFeatureEnabled); the DOM-update approach avoids navigation entirely; global sound changes work but affect the whole system (as showed).

Recommended Answers

All 3 Replies

hi farooqaaa, thanks for the reply but i can't see the page

Disable:

Public Sub DisableSound()
        Dim keyValue As String
        keyValue = "%SystemRoot%\Media\"
        If Environment.OSVersion.Version.Major = 5 AndAlso Environment.OSVersion.Version.Minor > 0 Then
            keyValue += "Windows XP Start.wav"
        ElseIf Environment.OSVersion.Version.Major = 6 Then
            keyValue += "Windows Navigation Start.wav"
        Else
            Return
        End If
        Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("AppEvents\Schemes\Apps\Explorer\Navigating\.Current", True)
        key.SetValue(Nothing, "", RegistryValueKind.ExpandString)
    End Sub

Enable:

Public Sub EnableSound()
        Dim keyValue As String
        keyValue = "%SystemRoot%\Media\"
        If Environment.OSVersion.Version.Major = 5 AndAlso Environment.OSVersion.Version.Minor > 0 Then
            keyValue += "Windows XP Start.wav"
        ElseIf Environment.OSVersion.Version.Major = 6 Then
            keyValue += "Windows Navigation Start.wav"
        Else
            Return
        End If
        Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("AppEvents\Schemes\Apps\Explorer\Navigating\.Current", True)
        key.SetValue(Nothing, keyValue, RegistryValueKind.ExpandString)
    End Sub

Source:

http://www.g4hq.com/forum/showthread.php/19021-%5BVB-Net%5DDisable-Enable-Internet-Explorer-s-clicking-sound

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.