Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set any application's volume

I was wondering how I could set a specific application (as in any running application, not just my own)'s volume level in c#.

I know I'd probably have to use P/invoke, this is fine. I'm just not sure on how the sound api's work and how I would go about getting/setting the volume of specific applications (like the volume mixer in vista/7 can).

I know it's possible to do programattically because nircmd has a feature that can do it.

Any help would be appriciated, thanks.

like image 307
Blam Avatar asked Sep 17 '11 21:09

Blam


1 Answers

I think you should look here. Following the links you'll find interfaces and API functions to use to manipulate endpoints' volume. Together with the documentation, Microsoft provided some code samples in C++. As you said, it is possible to get the same functionalities to work in .NET using platform invoke.

like image 122
Totem Avatar answered Oct 06 '22 20:10

Totem