在C#中控制计算机的音量 [英] Control the computer's volume in C#

查看:393
本文介绍了在C#中控制计算机的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以用C#控制计算机的实际音量并将其显示在垂直轨迹栏中?

Is there a way to control the computer's actual volume in C# and display that in a vertical track bar??

我几乎已经尝试了所有东西,但是肯定有一些我想念的东西.

I have tried practically everything, but there must be something I am missing.

谢谢.

推荐答案

您是否尝试过通过p/Invoke使用winmm.dll库?

Have you tried using the winmm.dll library through p/Invoke?

这就是本文的建议: http ://www.dreamincode.net/forums/topic/45693-controlling-sound-volume-in-c%23/

(奇怪的)他已经用GPL许可了他的代码,所以我不能在这里发布它.但这很基本,只需调用各种混合器方法即可.

He's (strangely) licensed his code with GPL, so I can't post it here. But it is pretty basic and simply calls various mixer methods.

还有一个带有MIT许可证的winmm包装器,您可以在这里获得: http://winmm.codeplex.com/.它具有相同的基础代码,但使用时无需对代码进行GPL.

There's another winmm wrapper with an MIT license you can get here: http://winmm.codeplex.com/. It will have the same underlying code, but you won't have to GPL your code when you use it.

这篇关于在C#中控制计算机的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆