809
社区成员
发帖
与我相关
我的任务
分享
Private Declare Function waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
Private Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
'音量范围0~100
Public Function GetVolume() As Integer
Dim V As Long
waveOutGetVolume 0, V
V = CLng("&H" & Right(Hex(V), 4))
GetVolume = CInt(100 * V / 2 ^ 16)
End Function
Public Sub SetVolume(ByVal Volume As Integer)
Dim Str As String
Str = Right(”0000“ & Hex(Volume/100 * 2 ^ 16), 4)
waveOutSetVolume 0, CLng("&H" & Str & Str)
End Sub