更改默认的音频设备上的Windows 7

更改默认的音频设备上的Windows 7

问题描述:

我希望能够编程使用C#更改默认的音频输出设备上的Windows 7(也可能是一些潜在的Win32 API调用,以及)。我已经做了我的功课,我听到了很多来自不同来源的混合的意见,所以我想再次问这个问题得到直接的答案。这实际上是可能的(通过的任何的意思)?如果是这样,我怎么会去这样做?

I want to be able to change the default audio output device on Windows 7 programatically using C# (and probably some underlying Win32 API calls, as well). I've already done my homework, and I've heard a lot of mixed comments from different sources, so I wanted to ask this question again to get a straight answer. Is this actually possible (through any means)? If so, how would I go about doing this?

和请不建议用的AutoIt或其他类似的计划的解决方案......这是一个C#/。NET-具体的问题。

And please do not suggest a solution with "AutoIt" or some other similar program... this is a C#/.NET-specific question.

万一有人碰到这个线程在未来绊倒......这里的一些C ++ code,它会通过调用一些无证的Win32 API做到这一点。这可以被编译成一个EXE,然后从一个.NET应用程序默默调用,所以你可以建立解决此code的.NET程序。

Just in case anyone stumbles across this thread in the future... here's some C++ code that'll do it by calling some undocumented Win32 APIs. This can be compiled into an EXE and then called silently from a .NET application, so you could build a .NET program around this code.

http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/