Control the computer's volume in C#

故事扮演 提交于 2019-12-10 18:56:50

问题


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.

Thanks.


回答1:


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

That's what this article recommends: http://www.dreamincode.net/forums/topic/45693-controlling-sound-volume-in-c%23/

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.

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.



来源:https://stackoverflow.com/questions/8192953/control-the-computers-volume-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!