win7系统设置了自动开机,自动播放音乐,然后用VBS脚本调节音量

win7系统设置了自动开机,自动播放音乐,然后用VBS脚本调节音量,第1张

不需要你那么麻烦,用以下命令实现音量减(用循环可以实现一直减):

Set WshShell = CreateObject("WScript.Shell")

WshShell.SendKeys(chr(&hAE))

音量增(用循环可以实现一直增):

Set WshShell = CreateObject("WScript.Shell")

WshShell.SendKeys(chr(&hAF))

本机测试通过,有问题追问哈。

Set WshShell = CreateObject("WScript.Shell")

WshShell.SendKeys "%{F8}" '按下F8键

WshShell.SendKeys "x" '按下x键,音量最大

WScript.Sleep 500 '暂停500毫秒

WshShell.SendKeys "{F8}" '放开F8键

给你个VB6代码做参考

Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer

Private Sub Command1_Click()

'设置到20%音量

waveOutSetVolume 0, &H33333333

End Sub

Private Sub Command2_Click()

'设置到90%音量

waveOutSetVolume 0, &HE666E666

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/12003360.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存