mengl520 发表于 2011-9-13 00:05

将音量降低到最无

Option Explicit
'==========================================================================================
'//功能:将音量降低到最无
'//用法:Call KillSound
'SendMessage 1000, WM_APPCOMMAND, &H30292, APPCOMMAND_VOLUME_UP * &H10000音量增加
'SendMessage 1000, WM_APPCOMMAND, &H30292, APPCOMMAND_VOLUME_DOWN * &H10000音量减少
'SendMessage 1000, WM_APPCOMMAND, &H200EB0, APPCOMMAND_VOLUME_MUTE * &H10000静音
'==========================================================================================
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
   ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   ByVal lParam As Long) As Long
Private Const WM_APPCOMMAND As Long = &H319
Private Const APPCOMMAND_VOLUME_UP As Long = 10
Private Const APPCOMMAND_VOLUME_DOWN As Long = 9
Private Const APPCOMMAND_VOLUME_MUTE As Long = 8
Public Sub KillSound()
    Dim i As Integer
    '降低到最小
    For i = 1 To 100
      SendMessage 1000, WM_APPCOMMAND, &H30292, APPCOMMAND_VOLUME_DOWN * &H10000
    Next i
    '静音
    SendMessage 1000, WM_APPCOMMAND, &H200EB0, APPCOMMAND_VOLUME_MUTE * &H10000
End Sub

xiaowan774 发表于 2011-12-3 00:15

{:1_906:}好贴啊1学习中
页: [1]
查看完整版本: 将音量降低到最无