Page 1 of 1

Disable sound in form

Posted: Sun Jul 22, 2012 11:34 am
by AnoPem
I want to disable the sound in the current form only, can this be done? if so how ?

Re: Disable sound in form

Posted: Sun Jul 22, 2012 2:37 pm
by mandai
If you are using Vista or later then the volume is already set per application.

You can adjust the volume with waveOutSetVolume. This sample might be useful:
Code: Select all
    <DllImport("winmm.dll")> Shared Function waveOutSetVolume(ByVal hwo As IntPtr, ByVal pdwVolume As UInteger) As UInteger
    End Function

    Private Sub btnMute_Click(sender As System.Object, e As System.EventArgs) Handles btnMute.Click

        waveOutSetVolume(IntPtr.Zero, 0)
    End Sub