
Changing the audio device this way is better (in my opinion) than directly modifying the Registry, which is always error prone because it's never exactly clear which Registry keys are involved. The panel actually appears on the screen briefly, but that's not a problem.

We programmatically launch the "Sounds and Audio Devices Properties" applet and manipulates the panel using the messaging system. OK, having those four caveats out of the way, here is the general idea.


Your own applications don't have to mimic this limitation (wink). Any third party application which outputs to the sound playback audio device, such as the Windows Media Player, has to be re-launched after the audio device has changed, because they usually consult the Registry and configure themselves only once at application launch time.Precisely because Microsoft did not want you to do this, this solution is by definition a kludge, a workaround.Backgroundīefore going further, a few things should be stated: This is a Managed C++ solution (.NET), but the method used here can be adapted easily to other languages. Have you ever wanted to switch the active audio output device (sound playback) on your Windows computer programmatically? Have you noticed that Microsoft (by design) has made it almost impossible to do this? Well, here is a solution to that problem.
