vb.net 中的控制音量 [英] Control Volume in vb.net
本文介绍了vb.net 中的控制音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在 vb.net 中控制主机音量.我在网上搜索并尝试了所有我能找到的例子.没有一个奏效.
I need to control the main computer volume in vb.net. I have searched the web and tried all the examples I could find. None of the have worked.
有没有人有一些与 vb.net 2010 一起使用来控制音量的代码片段?
Does anyone have some snippets of code that work with vb.net 2010 to control volume?
谢谢
乔达梅利奥
Thanks
giodamelio
推荐答案
我找到了答案.它使用 Nirsoft 的 NirCmd(32 位、
I found an answer. Its uses Nirsoft's NirCmd (32-bit , 64-bit)
Public Class Sound
Dim nircmd As String
Const MAXVOL As Integer = 65535
Public Sub New(ByVal nircmd_location As String)
nircmd = nircmd_location
End Sub
Public Sub setVol(ByVal level As Integer)
Dim p As New ProcessStartInfo
p.FileName = nircmd
p.Arguments = "setsysvolume " & (MAXVOL * (level / 100)).ToString
Process.Start(p)
End Sub
End Class
然后你可以使用类似的东西
You can then use somthing like
Dim vol As New Sound(path_to_nircmd)
vol.setVol(50)
这篇关于vb.net 中的控制音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文