如何检查Windows 7 OS中的主音量是否静音 我有静音或取消静音的代码 即
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))
这里我不会只检查主valume的静音条件。
提前。
答案 0 :(得分:1)
您可以通过"核心audio.dll"轻松查看。 API。
从here下载coreaudio.dll
在您的项目中引用它和..
使用以下代码:
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
希望这有效......
(抱歉英语不好)