Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all,
I have two buttons:
1. Start System Asterisk Sound button which plays system asterisk sound:
VB
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:
VB
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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900