Click here to Skip to main content
13,256,123 members (37,769 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hello to all,
I have two buttons:
1. Start System Asterisk Sound button which plays system asterisk sound:
Private Sub btnSystemAsteriskSound_Click(sender As Object, e As EventArgs) Handles btnSystemAsteriskSound.Click
        My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Asterisk)
    End Sub

2. MyButton is a button which has two events:
Private Sub btnMyButton_MouseEnter(sender As Object, e As EventArgs) Handles btnMyButton.MouseEnter
        My.Computer.Audio.Play(My.Resources.High1, AudioPlayMode.Background)
    End Sub
 
    Private Sub btnMyButton_MouseDown(sender As Object, e As MouseEventArgs) Handles btnMyButton.MouseDown
        If e.Button = MouseButtons.Left Then
            My.Computer.Audio.Play(My.Resources.Click1, AudioPlayMode.Background)
        Else
        End If
    End Sub

If I click on Asterisk button just before mouse hover and click of MyButton, I clearly hear mouse hovering and clicking, but at the end of playing sound of Asterisk button, I hear something but in the background and it is too quiet even if my sound speakers are on 100%. I realize that my events works only if there is a background sound which is behind pressing of Asterisk Button.
If I just click or hover over the MyButton, without previous clicking on the Asterisk button, it doesn't work correctly-sound is too quiet.

How to solve that even if there is not a background sound or music, hovers and clicks on/over the MyButton must emittate a specific sound that I set.

Preview of my form:
https://s2.postimg.org/im0k27zrt/Capture.png

What I have tried:

    Private Sub btnMyButton_MouseEnter(sender As Object, e As EventArgs) Handles btnMyButton.MouseEnter
        My.Computer.Audio.Play(My.Resources.High1, AudioPlayMode.Background)
    End Sub
 
    Private Sub btnMyButton_MouseDown(sender As Object, e As MouseEventArgs) Handles btnMyButton.MouseDown
        If e.Button = MouseButtons.Left Then
            My.Computer.Audio.Play(My.Resources.Click1, AudioPlayMode.Background)
        Else
        End If
    End Sub
 
    Private Sub btnSystemAsteriskSound_Click(sender As Object, e As EventArgs) Handles btnSystemAsteriskSound.Click
        My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Asterisk)
    End Sub
Posted 10-Nov-17 3:56am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 10 Nov 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100