Change default audio device on Windows 7(更改 Windows 7 上的默认音频设备)
问题描述
我希望能够使用 C# 以编程方式更改 Windows 7 上的默认音频输出设备(可能还有一些底层 Win32 API 调用).我已经完成了我的功课,并且我听到了很多来自不同来源的混合评论,所以我想再次问这个问题以获得直接的答案.这真的可能吗(通过 any 手段)?如果是这样,我该怎么做?
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++ 代码可以通过调用一些未记录的 Win32 API 来实现.这可以编译成 EXE,然后从 .NET 应用程序静默调用,因此您可以围绕此代码构建一个 .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://web.archive.org/web/20190317012739/http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/
这篇关于更改 Windows 7 上的默认音频设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更改 Windows 7 上的默认音频设备
基础教程推荐
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 如果条件可以为空 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
