How to disable click sound in WebBrowser Control

前端 未结 7 1259
庸人自扰
庸人自扰 2020-11-29 02:11

I use Javascript to click a link in the webbrowser control. But I don\'t want to hear IE\'s \"click\" sound.

Is there any way to do this?

P.S.

相关标签:
7条回答
  • 2020-11-29 02:44

    I cant make it work on VB.net, tried this:

    Private Const FEATURE_DISABLE_NAVIGATION_SOUNDS As Integer = 21
    Private Const SET_FEATURE_ON_THREAD As Integer = &H1
    Private Const SET_FEATURE_ON_PROCESS As Integer = &H2
    Private Const SET_FEATURE_IN_REGISTRY As Integer = &H4
    Private Const SET_FEATURE_ON_THREAD_LOCALMACHINE As Integer = &H8
    Private Const SET_FEATURE_ON_THREAD_INTRANET As Integer = &H10
    Private Const SET_FEATURE_ON_THREAD_TRUSTED As Integer = &H20
    Private Const SET_FEATURE_ON_THREAD_INTERNET As Integer = &H40
    Private Const SET_FEATURE_ON_THREAD_RESTRICTED As Integer = &H80
    
    Declare Function CoInternetSetFeatureEnabled Lib "urlmon.dll" ( _
    ByVal FeatureEntry As Integer, ByVal dwFlags As Long, _
    ByVal fEnable As Long) As Long
    

    ...

    CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, True)
    

    Edit: Found the problem, its within declaring. True one is:

    <SecurityCritical, SuppressUnmanagedCodeSecurity, DllImport("urlmon.dll", ExactSpelling:=True)> _
    Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry As Integer, ByVal dwFlags As Integer, ByVal fEnable As Boolean) As Integer
    End Function
    

    Thanks to dmex at http://msdn.microsoft.com/en-us/library/ms537168%28VS.85%29.aspx

    0 讨论(0)
提交回复
热议问题