user2931996
user2931996

Reputation: 11

how to check the master volume is muted or not

how to check the master volume is muted in windows 7 OS I have the code for mute or unmute i.e

Public Const APPCOMMAND_VOLUME_MUTE As Integer = &H80000
Public Const APPCOMMAND_VOLUME_UP As Integer = &HA0000
Public Const APPCOMMAND_VOLUME_DOWN As Integer = &H90000
Public 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
MM.SendMessageW(Me.Handle, MM.WM_APPCOMMAND, Me.Handle, CType(MM.APPCOMMAND_VOLUME_MUTE, IntPtr))

here i wont to check only mute condition of master valume.

than q in advance.

Upvotes: 1

Views: 2108

Answers (1)

Ankit Satapara
Ankit Satapara

Reputation: 43

You can easily check by "core audio.dll" api.

download coreaudio.dll from here

Refernce it in your project and..

than use the following code:

private function getmute() as boolean
    Dim devenum As New MMDeviceEnumerator
    Dim device As MMDevice = devenum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia)
    If device.AudioEndpointVolume.Mute = True Then
        Return True
    Else
        Return False
    End If
End Function

hope this works....

(sorry for bad english)

Upvotes: 1

Related Questions