Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[help] how to disable sound in webbrowser ? [vb.net]

(Mar 20, 2010 12:29 AM)Pr4wn Wrote:  I had to modify it a bit to work in my vb 2008 so if mine doesn't work for you try the original code at links.

References:
http://stackoverflow.com/questions/39316...er-control
http://msdn.microsoft.com/en-us/library/...85%29.aspx


Code
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


    <Security.SecurityCritical(), Security.SuppressUnmanagedCodeSecurity(), Runtime.InteropServices.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


'place this piece in a sub
CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, True)

ill try it when im at home


(Mar 20, 2010 12:31 AM)ubbelol Wrote:  What sound are you talking about? The click sound on loadings or like youtube videos sound?

youtube videos sound
(Mar 20, 2010 01:50 AM)rawi16 Wrote:  ill try it when im at home


(Mar 20, 2010 12:31 AM)ubbelol Wrote:  What sound are you talking about? The click sound on loadings or like youtube videos sound?

youtube videos sound

Oh the code I posted stops the 'click' sound whilst navigating. To mute youtube you would have to make something that can modify the volume value. Look for how to make a flash trainer in VB it might help.
(Mar 20, 2010 12:29 AM)Pr4wn Wrote:  I had to modify it a bit to work in my vb 2008 so if mine doesn't work for you try the original code at links.

References:
http://stackoverflow.com/questions/39316...er-control
http://msdn.microsoft.com/en-us/library/...85%29.aspx


Code
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


    <Security.SecurityCritical(), Security.SuppressUnmanagedCodeSecurity(), Runtime.InteropServices.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


'place this piece in a sub
CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, True)


tried it , but it didnt help.
cmon , if som1 knows , tell me how , i really need it.
https://hackforums.net/showthread.php?ti...t+explorer

Should work for all sound on webbrowser.
i dont want to disable the click sound , i want to disable sounds , like youtube videos sound.
(Mar 20, 2010 06:52 AM)rawi16 Wrote:  i dont want to disable the click sound , i want to disable sounds , like youtube videos sound.

As I said, it should work for all IE sounds.
(Mar 19, 2010 12:27 PM)rawi16 Wrote:  thats wt i did :

module1.vb :

Code
Imports Microsoft.Win32

Module Module1
    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
End Module


form1.vb :

Code
Imports Microsoft.Win32

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DisableSound()
    End Sub

End Class


and its not working.

(Mar 20, 2010 06:55 AM)Joey K Wrote:  
(Mar 20, 2010 06:52 AM)rawi16 Wrote:  i dont want to disable the click sound , i want to disable sounds , like youtube videos sound.

As I said, it should work for all IE sounds.

already tried it , and didnt work.
i might be a few years late but this is how you mute an entire form

Public Class Form2

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Const APPCOMMAND_VOLUME_MUTE As Integer = &H80000
Private Const WM_APPCOMMAND As Integer = &H319
Declare Function SendMessageW Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

Private Sub PausePlayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PausePlayToolStripMenuItem.Click
SendMessageW(Me.Handle, WM_APPCOMMAND, Me.Handle, CType(APPCOMMAND_VOLUME_MUTE, IntPtr))

End Sub
End Class

or you could put the web browser in another form and hide and disable the form, makine form1 have functions like form2.webbrowser1.navigate()
Easy peezy , just turn your volume down for the program in sound control :P
(Mar 20, 2010 12:29 AM)Pr4wn Wrote:  I had to modify it a bit to work in my vb 2008 so if mine doesn't work for you try the original code at links.

References:
http://stackoverflow.com/questions/39316...er-control
http://msdn.microsoft.com/en-us/library/...85%29.aspx

Code
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

    <Security.SecurityCritical(), Security.SuppressUnmanagedCodeSecurity(), Runtime.InteropServices.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

'place this piece in a sub
CoInternetSetFeatureEnabled(FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, True)

Registered just to say a big thank you for this post. Couldn't find this code anywhere online.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by AstateAug 10, 2021 10:21 AM 6 696 Aug 10, 2021 10:21 AM
Last Post: SIM-5033784
[.NET] by D3ath_GuNJan 3, 2020 01:49 PM 4 252 Jan 3, 2020 01:49 PM
Last Post: Krysis
[.NET] by isuDec 25, 2018 03:53 PM 3 202 Dec 25, 2018 03:53 PM
Last Post: StarZ