void RegisterHotKeys() { ghkNotepad.Enabled = chkNotepad.Checked; ghkWordpad.Enabled = chkWordpad.Checked; ghkCalc.Enabled = chkCalculator.Checked; ghkTaskMan.Enabled = chkTaskManager.Checked; ghkUninstall.Enabled = chkUninstall.Checked; ghkCustom.Enabled = chkCustomEnabled.Checked; lhkNewHotkey.Enabled = chkNewHotKey.Checked; lhkNewLocalKey.Enabled = chkNewLocal.Checked; lhkCopyLog.Enabled = chkCopyClipboard.Checked; lhkClearLog.Enabled = chkCopyClipboard.Checked; lhkDisableLog.Enabled = chkDisableLogging.Checked; //Store an information in the tag of the hotkeys. ghkNotepad.Tag = "Notepad.exe"; ghkWordpad.Tag = "Wordpad.exe"; ghkCalc.Tag = "Calc.exe"; ghkTaskMan.Tag = "Taskmgr.exe"; ghkUninstall.Tag = "appwiz.cpl"; chotCmd.Tag = "cmd.exe"; chotPowerShell.Tag = "powershell.exe"; chotIExplore.Tag = "iexplore.exe"; chotRegEdit.Tag = "regedit.exe"; chotCharMap.Tag = "charmap.exe"; lhkNewHotkey.HotKeyPressed += delegate { AddNewHotKey(); }; //Now, we'll add the Keys to the HotKeyManager MyHotKeyManager.AddGlobalHotKey(ghkNotepad); MyHotKeyManager.AddGlobalHotKey(ghkWordpad); MyHotKeyManager.AddGlobalHotKey(ghkCalc); MyHotKeyManager.AddGlobalHotKey(ghkTaskMan); MyHotKeyManager.AddGlobalHotKey(ghkUninstall); MyHotKeyManager.AddGlobalHotKey(ghkCustom); //Add the Local HotKeys. MyHotKeyManager.AddLocalHotKey(lhkNewHotkey); MyHotKeyManager.AddLocalHotKey(lhkNewLocalKey); MyHotKeyManager.AddLocalHotKey(lhkCopyLog); MyHotKeyManager.AddLocalHotKey(lhkClearLog); MyHotKeyManager.AddLocalHotKey(lhkDisableLog); //Add the Chord HotKeys. MyHotKeyManager.AddChordHotKey(chotCmd); MyHotKeyManager.AddChordHotKey(chotPowerShell); MyHotKeyManager.AddChordHotKey(chotIExplore); MyHotKeyManager.AddChordHotKey(chotRegEdit); MyHotKeyManager.AddChordHotKey(chotCharMap); }
void RegisterHotKeys() { MyHotKeyManager = new HotKeyManager(this); MyHotKeyManager.AddGlobalHotKey(ghkPlay); MyHotKeyManager.AddGlobalHotKey(ghkStop); MyHotKeyManager.AddGlobalHotKey(ghkFile); MyHotKeyManager.AddLocalHotKey(lhkPlay); MyHotKeyManager.AddLocalHotKey(lhkStop); MyHotKeyManager.AddLocalHotKey(lhkFile); MyHotKeyManager.AddLocalHotKey(lhkScreen); MyHotKeyManager.AddChordHotKey(chotPlay); MyHotKeyManager.AddChordHotKey(chotStop); MyHotKeyManager.AddChordHotKey(chotFile); MyHotKeyManager.GlobalHotKeyPressed += new GlobalHotKeyEventHandler(MyHotKeyManager_GlobalHotKeyPressed); MyHotKeyManager.LocalHotKeyPressed += new LocalHotKeyEventHandler(MyHotKeyManager_LocalHotKeyPressed); MyHotKeyManager.ChordPressed += new ChordHotKeyEventHandler(MyHotKeyManager_ChordPressed); }