更改播放设备编程XP [英] Change playback device programatically xp

查看:148
本文介绍了更改播放设备编程XP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能改变这是目前的声卡使用(XP),没有进入控制面板>声音设备>选择播放设备。

How can i change which is the current sound card in use (xp), without going into control panel>sounds devices> choose playback device.

任何语言就足够了,或批处理文件,只是我必须要改变设备中进行播放,每天约50倍,其疼痛不必每次加载控制面板。

any language would suffice, or batch file, just that i have to change the device for playback about 50 times a day and its a pain having to load control panel each time.

谁知道怎么样?

推荐答案

要设置在Windows XP中默认的声音播放设备,您可以更改以下注册表项的值:

To set the default sound playback device in Windows XP, you can change the value of the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper\Playback

也许最简单的事情,因为所有你希望能够从安装选择设备的现有配置,是在声音和音频设备属性控制一次选择每个声音播放设备之一面板和设置导出此注册表项到一个文件中。所以,如果你有,你希望能够之间进行选择3声音播放设备,你最终会用3个单独的reg文件,每个对应播放设备之一。否则,你将不得不生成注册表项以编程文件上飞。

Probably the easiest thing to do, given an existing configuration with all of the devices you wish to be able to select from installed, is to select each of the sound playback devices one at a time in the Sound and Audio Device Properties control panel and export the settings for this registry key to a file. So, if you had 3 sound playback devices that you wanted to be able to choose between, you would end up with 3 separate .REG files, each corresponding to one of the playback devices. Otherwise, you will have to generate the registry entry files programmatically on the fly.

一旦你产生这些reg文件,他们在资源管理器1只需双击将插入它们包含到注册表中相应的位置,这将选择相应播放设备的信息。您可以轻松地通过编程执行这些注册表脚本。在C#中,你可能会使用类似 System.Diagnostics.Process.Start 并传递要生效,该.reg文件的位置。或者,您可以编写一个默默导入注册表项文件,而不需要确认一个简单的批处理文件:

Once you've generated these .REG files, simply double-clicking on one of them in Explorer will insert the information that they contain into the appropriate location in the registry, which will select the corresponding playback device. You can easily execute these registry scripts programmatically. In C#, you might use something like System.Diagnostics.Process.Start and pass the location of the .REG file that you want to take effect. Alternatively, you could write a simple batch file that silently imports the registration entries file without requiring confirmation:

@echo off
%windir%\regedit.exe /s ExternalSpeakers.reg

不用说,在应用该解决方案,并手动编辑注册表,你拿的,你可能会与你的Windows安装大肆任何破坏承担全部责任。

It goes without saying that in applying this solution and manually editing your registry, you take full responsibility for any havoc that you may wreak with your Windows installation.

(据我所知,Windows XP的解决办法是什么,提问者正在寻找,但对于未来谷歌,请注意,这将不会与Windows Vista或更高版本,它使用的核心音频来管理这些设置,而不是见<一href="http://stackoverflow.com/questions/1555156/c-how-to-programatically-change-the-playback-device">this问题一个解决方案。)

(I understand that a Windows XP solution is what the asker is looking for, but for any future Googlers, note that this will NOT work with Windows Vista or later, which uses the Core Audio APIs to manage these settings instead. See this question for a solution.)

这篇关于更改播放设备编程XP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆