c# - Suppressing global windows shortcuts while recording keypresses -
is possible suppress windows global shortcuts while recording keypresses ?
i have windows form application written in c#, , using library record keypresses use later in macros. when record key combinations used windows (i.e. l control + win + right arrow change virtual desktop on win 10), i'd app record avoid windows using while record quite annoying.
i have checkbox enable key capturing, on click event
m_keyboardhookmanager.keydown += hookmanager_keydown;
the hookmanager_keydown this
private void hookmanager_keydown(object sender, keyeventargs e) { log(string.format("keydown \t\t {0}\n", e.keycode)); string [] sarr = new string [2]; if (keybindingarea1.text != "") { sarr[0] = keybindingarea1.text; sarr[1] = string.format("{0}", e.keycode); keybindingarea1.text = string.join("+", sarr); } else { keybindingarea1.text = string.format("{0}", e.keycode); } }
which display key combination in combotext control. (this code taken directly demo attached package.
now recording work if instance press l control + win, release keys , press third 1 (i.e. right arrow), not trigger windows shortcuts quite annoying have work that.
appreciate help. thanks
try use e.handled
property of event. if set true
terminate key procesing chain. rule oher applications in processing chain not it. not sure going work such low level windows staff virtual desktop switch.
private void onkeypress(object sender, system.windows.forms.keypresseventargs e) { bool isthirdkey = //some state evaluation detect third key pressed if (isthirdkey) e.handled = true; }
Comments
Post a Comment