From time to time I like to post about other issues which are not related to crypto stuff, but I consider useful because of the number of request I get on them. And this is one common question I've seen: how do I set sound volume programmatically on Windows?
On Windows XP we can manipulate audio settings with Wave API or Dsound API (Direct Sound). The following function may help here: waveOutSetVolume. Here is the rest of the API: Waveform Functions. And here we can find a .NET sample which mixes .NET classes and that API: Using P/Invoke to Call Unmanaged APIs from Your Managed Classes. Another sample, this time from a third-party: Mute volume in vb.net program.
On Windows Vista and later that API is no longer available. We may use MMDevice API and EndpointVolume API instead. Here you can see some samples: How do I change the master volume in Windows Vista & Vista Core Audio API Master Volume Control.
I hope this helps.
Alex (Alejandro Campos Magencio)
I use EndpointVolume API on windows 7
Can you help me with some issues related to the EndpointVolume API?
1. When I used Wave API on windows XP, I could control the volume CD in. I put on the same computer, windows 7, and found all audio devices through the EndpointVolume API, but CD in did not find. In the windows 7 system mixer, CDIN also absent.
How can I solve this problem?
2. In the system mixer (in microphone properties) is a property of "Listen to this device". How can I programmatically change the property?