vb如何用trackBar控件实现系统声音大小的调节?急的!
1个回答
展开全部
[工程]--[部件],勾选Microsoft Windows Common Control 6.0。
通过工具箱添加:Slider1控件。
代码如下:
Option Explicit
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer '获取设备的音量的API函数
Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer '设置设备的音量的API函数
Private Sub Slider1_Change()
Dim a, i As Long
Dim tmp As String, vol As String
vol = Slider1.Value
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub
千万注意:本程序修改音量后,仍然通过本程序恢复音量到最大。
通过工具箱添加:Slider1控件。
代码如下:
Option Explicit
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer '获取设备的音量的API函数
Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer '设置设备的音量的API函数
Private Sub Slider1_Change()
Dim a, i As Long
Dim tmp As String, vol As String
vol = Slider1.Value
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub
千万注意:本程序修改音量后,仍然通过本程序恢复音量到最大。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询