現在的 Keyboard 通常會附多媒體鍵,不過預設值打開可能就是討人厭音質又差的 Windows Media Player。 如果我們希望這些鍵可以按下去是開啟我們想要的軟體,此時通常要裝 Driver,問題是有時候會找不到 Driver,那也沒關係,直接改機碼就可以囉,以下是說明:
- 先執行
regedit
- 機碼位於
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\
- 機碼位於
- 在其下加入數字機碼,代表對應的 AppKey 按鍵 (詳見對應表)
- 例:
16
就是Media
切換功能 - 要換掉的話可以先將原來的值備份
- 然後添加一字串值名稱為
ShellExecute
- 值就填入喜歡的撥放器的路徑就可以了
- 例:
Action | Description |
---|---|
RegisteredApp | It's not clear how this is (was?) supposed to work. The example in the docs set the value to "mail" which would supposedly open up the application that is registered to handle mail. However, in Vista and Win7, the value for AppKey 15 is association to "mailto" (a MIME handler). My thinking is that "RegisteredApp" must have been deprecated. Another possibility: The registry key HKLM\Software\Clients seems to provide a means for applications to register themselves as the "default app" for some things. If you want to explore this, that's one direction to go (see this blog for some related information). But since you can use ShellExecute to do most anything you want, it seems unnecessary. |
Association | The value entry is a file extension or MIME type. For instance, the item that's associated with my dedicated "Internet" button is: Association REG_SZ http The system will run whatever program is associated with that file type or MIME type. |
ShellExecute | The value is any command that you can execute by typing in at a DOS prompt or in the Start / Run input box. You can pass arguments to the program, but be sure to wrap the whole thing in quotes. For instance, ShellExecute REG_SZ "Notepad.Exe MyToDoList.Txt" |
AppCommand values from Winuser.h
1 | APPCOMMAND_BROWSER_BACKWARD |
2 | APPCOMMAND_BROWSER_FORWARD |
3 | APPCOMMAND_BROWSER_REFRESH |
4 | APPCOMMAND_BROWSER_STOP |
5 | APPCOMMAND_BROWSER_SEARCH |
6 | APPCOMMAND_BROWSER_FAVORITES |
7 | APPCOMMAND_BROWSER_HOME |
8 | APPCOMMAND_VOLUME_MUTE |
9 | APPCOMMAND_VOLUME_DOWN |
10 | APPCOMMAND_VOLUME_UP |
11 | APPCOMMAND_MEDIA_NEXTTRACK |
12 | APPCOMMAND_MEDIA_PREVIOUSTRACK |
13 | APPCOMMAND_MEDIA_STOP |
14 | APPCOMMAND_MEDIA_PLAY_PAUSE |
15 | APPCOMMAND_LAUNCH_MAIL |
16 | APPCOMMAND_LAUNCH_MEDIA_SELECT |
17 | APPCOMMAND_LAUNCH_APP1 |
18 | APPCOMMAND_LAUNCH_APP2 |
19 | APPCOMMAND_BASS_DOWN |
20 | APPCOMMAND_BASS_BOOST |
21 | APPCOMMAND_BASS_UP |
22 | APPCOMMAND_TREBLE_DOWN |
23 | APPCOMMAND_TREBLE_UP |
24 | APPCOMMAND_MICROPHONE_VOLUME_MUTE |
25 | APPCOMMAND_MICROPHONE_VOLUME_DOWN |
26 | APPCOMMAND_MICROPHONE_VOLUME_UP |
27 | APPCOMMAND_HELP |
28 | APPCOMMAND_FIND |
29 | APPCOMMAND_NEW |
30 | APPCOMMAND_OPEN |
31 | APPCOMMAND_CLOSE |
32 | APPCOMMAND_SAVE |
33 | APPCOMMAND_PRINT |
34 | APPCOMMAND_UNDO |
35 | APPCOMMAND_REDO |
36 | APPCOMMAND_COPY |
37 | APPCOMMAND_CUT |
38 | APPCOMMAND_PASTE |
39 | APPCOMMAND_REPLY_TO_MAIL |
40 | APPCOMMAND_FORWARD_MAIL |
41 | APPCOMMAND_SEND_MAIL |
42 | APPCOMMAND_SPELL_CHECK |
43 | APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE |
44 | APPCOMMAND_MIC_ON_OFF_TOGGLE |
45 | APPCOMMAND_CORRECTION_LIST |
46 | APPCOMMAND_MEDIA_PLAY |
47 | APPCOMMAND_MEDIA_PAUSE |
48 | APPCOMMAND_MEDIA_RECORD |
49 | APPCOMMAND_MEDIA_FAST_FORWARD |
50 | APPCOMMAND_MEDIA_REWIND |
51 | APPCOMMAND_MEDIA_CHANNEL_UP |
52 | APPCOMMAND_MEDIA_CHANNEL_DOWN |
53 | APPCOMMAND_DELETE |
54 | APPCOMMAND_DWM_FLIP3D |
- http://ccanywhere.pixnet.net/blog/post/26249327-%E5%A6%82%E4%BD%95%E4%BF%AE%E6%94%B9windows%E9%8D%B5%E7%9B%A4%E5%B0%8D%E6%87%89
- http://www.experts-exchange.com/articles/2155/Keyboard-Remapping-CAPSLOCK-to-Ctrl-and-Beyond.html
- 新增
D:\SendKey.js
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
- 執行用指令
CScript /nologo /E:JScript D:\SendKey.js "{ENTER}"
- 設定於 AppKey
ShellExecute
REG_SZ
CScript /nologo /E:JScript D:\SendKey.js "{ENTER}"
- 參考按鍵清單 https://msdn.microsoft.com/en-us/library/8c6yea83(v=vs.84).aspx
CustomAppKey.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\15]
"ShellExecute"="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe https://inbox.google.com/u/0/"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\16]
"Association"=".cda"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\17]
"ShellExecute"="C:\\Windows\\System32\\SnippingTool.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18]
"ShellExecute"="calc.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\7]
"ShellExecute"="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe https://www.google.com.tw/"
Thanks for the information on
RegisteredApp
andAssociation
! Another blog post, and a Super User answer on the topic. (I am not affiliated with either.)