スピーカーとヘッドホンを簡単に切り替えたいのですが、可能ですか?
答え1
デフォルトのオーディオデバイスを切り替える方法はいくつかあります。しかし、これに関するAPIが公開されていないため、ほとんどの場合、次のようなハックが必要になります。キーを送信しようとしていますあまり堅牢ではありません。
APIはハードウェアの非互換性を避けるために非公開で文書化されていないため、ブラウザのデフォルトのホームページのようにメーカーが争うことがありません。しかし、誰かがWindows 7 のコマンド ラインでオーディオ デバイスを切り替えるそしてコメント欄ではWarNovがすでに「Windows 8 でテストしました。完璧に動作します。」。
文書化されていない API を使用しているため、将来のバージョンの Windows では動作しなくなる可能性があることに注意してください。
ジェリーがすでに述べたように、タイルを使ったショートカット、C++コードを呼び出すだけです。.NETで使用したい場合は、ラッパーを使用する。
コードはGitHubでも公開されています。オーディオエンドポイントコントローラ使い方についてはわかりやすいドキュメント付きです:
> EndPointController.exe --help
Lists active audio end-point playback devices or sets default audio end-point
playback device.
USAGE
EndPointController.exe [-a] [-f format_str] Lists audio end-point playback
devices that are enabled.
EndPointController.exe device_index Sets the default playback device
with the given index.
OPTIONS
-a Display all devices, rather than just active devices.
-f format_str Outputs the details of each device using the given format
string. If this parameter is ommitted the format string
defaults to: "Audio Device %d: %ws"
Parameters that are passed to the 'printf' function are
ordered as follows:
- Device index (int)
- Device friendly name (wstring)
- Device state (int)
- Device default? (1 for true 0 for false as int)
- Device description (wstring)
- Device interface friendly name (wstring)
- Device ID (wstring)''
答え2
タイルはバッチ ファイルや PowerShell ファイルへのショートカットになります。タイルをタップすると、バッチ ファイルまたは PS ファイルが実行されます。つまり、Windows でほぼ何でも実行できるタイルを作成できるということです。
CS テクニックは次のとおりです。
回答としてマークされていない回答は、Windows 7/8 の解決策のようです。
残念ながら、この特定の API ではこれが最善かもしれません。
ショートカットテクニックは次のとおりです。http://www.howtogeek.com/74331/how-to-create-your-own-windows-8-shortcuts-for-shutdown-perhaps/
ちなみに、Windows RTデバイスにもPowerShellがあります