1.11M Members

Dissable Sound Of Web Object

 
0
 

Hello to everyone
I am a begginer in VB6.
My project consist just on a form and a web object, the problem is that I want to dissable the
sound that make the application when I click on links. Can someone help me?!
Plese write the code here because I am not familiar with VBS syntax!

 
0
 

You can try something like -

Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Sub Form_Load()
    WebBrowser1.Navigate "http://www.daniweb.com/software-development/visual-basic-4-5-6/4"
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
    Call sndPlaySound(vbNullString, False)
End Sub

Private Sub WebBrowser1_UpdatePageStatus(ByVal pDisp As Object, nPage As Variant, fDone As Variant)
    Call sndPlaySound(vbNullString, False)
End Sub

Private Sub WebBrowser1_DownloadBegin()
    Call sndPlaySound(vbNullString, False)
End Sub
 
0
 

Thank you for the example, but as I told I am a begginer :(

The code under under form1.vb is this: (Where should I and the code code that you showed to me?!)

<System.Runtime.InteropServices.ComVisible(False)> Public Class Form1

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    End Sub

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

    End Sub 

End Class
 
0
 

Ahhh, its all coming together now. :)

You are working in VB.NET whilst your question was posted in VB6.

I'll ask that the post be moved to VB.NET. In the mean while, try -

<System.Runtime.InteropServices.ComVisible(False)> Public Class Form1

    Private Declare Function sndPlaySound Lib "winmm.dll" Alias _"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    Call sndPlaySound(vbNullString, False)

    End Sub

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

    WebBrowser1.Navigate "http://www.daniweb.com/software-development/visual-basic-4-5-6/4"

    End Sub 
End Class
 
0
 

I am interpreting the OP's question to be how to disable those annoying navigation clicks.

This looks like much more code than it really is as I just cut it out of my browser class with all the included documentation.

Public Class Form1
   'Disables Navigation Sound
   Private Sub btnMuteNav_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMuteNav.Click
      CoInternetSetFeatureEnabled( _
      INTERNETFEATURELIST.DISABLE_NAVIGATION_SOUNDS, dwflags.SET_FEATURE_ON_PROCESS, True)
   End Sub

   'Enables Navigation Sound
   Private Sub btnUnMuteNav_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnMuteNav.Click
      CoInternetSetFeatureEnabled( _
      INTERNETFEATURELIST.DISABLE_NAVIGATION_SOUNDS, dwflags.SET_FEATURE_ON_PROCESS, False)
   End Sub

#Region "Interop garblygoop"

   ''' <summary>
   ''' Enables or disables a specified feature control. 
   ''' </summary>
   ''' <param name="FeatureEntry">A value from the INTERNETFEATURELIST enumeration that indicates the feature control to enable or disable.</param>
   ''' <param name="dwFlags">Specifies where to set the feature control value. Can be one of the following values: </param>
   ''' <param name="fEnable">A BOOL that indicates that the feature control specified by FeatureEntry is enabled when fEnable is TRUE. </param>
   ''' <returns>S_OK-Success, E_FAIL-FeatureEntry is invalid. </returns>
   ''' <remarks>The SET_FEATURE_ON_PROCESS flag is available for all values of INTERNETFEATURELIST except FEATURE_LOCALMACHINE_LOCKDOWN. All other values of dwFlags are available only when FeatureEntry is FEATURE_LOCALMACHINE_LOCKDOWN or FEATURE_PROTOCOL_LOCKDOWN.  Note  You cannot enable FEATURE_LOCALMACHINE_LOCKDOWN with this method, because doing so would bypass initialization that is based on whether this feature is enabled when a process starts. To correctly enable FEATURE_LOCALMACHINE_LOCKDOWN, you must set a Feature Control Key in the registry. For more information, see Introduction to Feature Controls.  The CoInternetSetFeatureEnabled function was introduced in Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2). </remarks>
   <System.Runtime.InteropServices.DllImport("urlmon.dll"), System.Runtime.InteropServices.PreserveSig()> _
   Shared Function CoInternetSetFeatureEnabled( _
      ByVal FeatureEntry As Int32, _
      <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)> ByVal dwFlags As Int32, _
      ByVal fEnable As Boolean) As <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Error)> Int32
   End Function

   <Flags()> _
   Private Enum dwflags As Int32
      SET_FEATURE_ON_THREAD = &H1
      SET_FEATURE_ON_PROCESS = &H2
      SET_FEATURE_IN_REGISTRY = &H4
      SET_FEATURE_ON_THREAD_LOCALMACHINE = &H8
      SET_FEATURE_ON_THREAD_INTRANET = &H10
      SET_FEATURE_ON_THREAD_TRUSTED = &H20
      SET_FEATURE_ON_THREAD_INTERNET = &H40
      SET_FEATURE_ON_THREAD_RESTRICTED = &H80
   End Enum

   Private Enum INTERNETFEATURELIST As Int32
   '''<summary>Block access to objects instantiated and cached in one domain from another domain. </summary>
     OBJECT_CACHING = 0
   '''<summary>Prevent non-user initiated navigation between a page in one zone to a page in a higher security zone. This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_ZONE_ELEVATION. </summary>
     ZONE_ELEVATION = 1
   '''<summary>Check for consistency between the file name extension, the Content-Type value in the HTTP header, the Content-Disposition value in the HTTP header, and the file type that is detected when a file's signature bits are examined, or sniffed. This type of sniff is called a MIME sniff. Files that are determined to have inconsistent information in these areas are renamed and moved to the Internet Explorer cache.</summary>
     MIME_HANDLING = 2
   '''<summary>Allow the process to determine a file's type by examining its bit signature. Internet Explorer uses this information to determine how to render the file. This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_MIME_SNIFFING. </summary>
     MIME_SNIFFING = 3
   '''<summary>Constrain to the viewable desktop area and force to have a status bar. Also, restrict the size and position of pop-up windows without chrome so that they cannot overlay important information on their parent windows and cannot overlay system dialog box information. This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_WINDOW_RESTRICTIONS. </summary>
     WINDOW_RESTRICTIONS = 4
   '''<summary>Enable applications hosting the WebBrowser Control to receive the default Internet Explorer pop-up management behavior. </summary>
     WEBOC_POPUPMANAGEMENT = 5
   '''<summary>Allow Binary Behaviors to run securely. This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_BEHAVIOR_RUN.</summary>
     BEHAVIORS = 6
   '''<summary>Fail resources hosted on the MK: protocol.</summary>
     DISABLE_MK_PROTOCOL = 7
   '''<summary>Apply Local Machine Zone security settings to all local content. </summary>
     LOCALMACHINE_LOCKDOWN = 8
   '''<summary>Show the default Internet Explorer Information Bar when file download or code installation is restricted. </summary>
     SECURITYBAND = 9
   '''<summary>Block ActiveX controls on pages that instantiate or prompt for ActiveX controls to be installed or when the control is an update to a control that is not installed. This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_AUTOMATIC_ACTIVEX_UI. </summary>
     RESTRICT_ACTIVEXINSTALL = 10
   '''<summary>Block navigation to any page with a badly formed URL.</summary>
     VALIDATE_NAVIGATE_URL = 11
   '''<summary>Block file downloads that navigate to a resource, that display a file download dialog box, or that are not initiated explicitly by a user action (for example, a mouse click or key press). This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_AUTOMATIC_DOWNLOAD_UI. </summary>
     RESTRICT_FILEDOWNLOAD = 12
   '''<summary>Block add-ons that are disabled by the user or group policy so that they do not run or install. </summary>
     ADDON_MANAGEMENT = 13
   '''<summary>Restrict selected protocols from performing URL actions in particular security zones. A list of restricted protocols is maintained for each zone. </summary>
     PROTOCOL_LOCKDOWN = 14
   '''<summary>Invalidate URL syntax that may include a user name and password (http(s)://username:password@server/). </summary>
     HTTP_USERNAME_PASSWORD_DISABLE = 15
   '''<summary>Perform additional safety checks when calling IBindHost::MonikerBindToObject to create and initialize ActiveX controls. Specifically, prevent the control from being created if COMPAT_EVIL_DONT_LOAD is in the registry for the control. Also, check the URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY security setting for the zone of the URL being bound to and determine whether the control can be safely initialized. Note  To avoid the check for specific binds in a process, pass BINDINFO_OPTIONS_SECURITYOPTOUT to BINDINFO.dwOptions when calling IBindStatusCallback::GetBindInfo.</summary>
     SAFE_BINDTOOBJECT = 16
   '''<summary>Evaluate the "saved from url" information for files on a UNC share. This feature increases security on UNC paths but at a performance cost. </summary>
     UNC_SAVEDFILECHECK = 17
   '''<summary>Return unencoded file paths for files that use the "file://" protocol scheme. </summary>
     GET_URL_DOM_FILEPATH_UNENCODED = 18
   '''<summary>Windows Internet Explorer 7. Enable tabbed browsing shortcuts and notifications.</summary>
     TABBED_BROWSING = 19
   '''<summary>Windows Internet Explorer 7. Suppress WinInet dialog boxes for SSL errors. For more information, see BINDINFO_OPTIONS_IGNORE_SSLERRORS_ONCE.</summary>
     SSLUX = 20
   '''<summary>Windows Internet Explorer 7. Disable the sounds that are played when the user opens a link.</summary>
     DISABLE_NAVIGATION_SOUNDS = 21
   '''<summary>Windows Internet Explorer 7. Deactivate legacy compression architecture, and consolidate manipulation of HTTP data. The new architecture provides consistency between transfer encoding (such as HTTP no-cache headers) and content encoding. Note  Internet Explorer 9 and later. Legacy compression is no longer available.</summary>
     DISABLE_LEGACY_COMPRESSION = 22
   '''<summary>Windows Internet Explorer 7. Require new windows to include both address and status bar.</summary>
     FORCE_ADDR_AND_STATUS = 23
   '''<summary>Windows Internet Explorer 7. Enable or disable the native XMLHttpRequest object.</summary>
     XMLHTTP = 24
   '''<summary>Windows Internet Explorer 7. Disable the built-in telnet protocol handler. </summary>
     DISABLE_TELNET_PROTOCOL = 25
   '''<summary>Windows Internet Explorer 7. Enable MIME-sniffing for RSS feeds, and feed auto-discovery.</summary>
     FEEDS = 26
   '''<summary>Windows Internet Explorer 7. Enable or disable the pop-up blocker to show input prompt dialog boxes. Used pop-up blocker to mitigate the risk of spoofing.</summary>
     BLOCK_INPUT_PROMPTS = 27
    '''<summary>The total number of items in this enumeration. </summary>
     ENTRY_COUNT = 28
   End Enum

#End Region

End Class
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: