Disable ESC key...
-
I am working with a 3rd party app that takes focus when it needs to perform certain tasks. The problem with this is if the user presses the ESC key the application needs to be reloaded. Is there an easy way to disable the ESC key before it takes focus and then re-enable it when focus is returned to my app? Thanx for all the input... t
-
I am working with a 3rd party app that takes focus when it needs to perform certain tasks. The problem with this is if the user presses the ESC key the application needs to be reloaded. Is there an easy way to disable the ESC key before it takes focus and then re-enable it when focus is returned to my app? Thanx for all the input... t
Easy? No... You'll have to write either a keyboard hook that looks at every keystroke and doesn't pass on the ESC key, or write a Message Filter that implements IMessageFilter to do the same thing. The keyboard hook is harder to write... The docs for the MessageFilter starts here[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Easy? No... You'll have to write either a keyboard hook that looks at every keystroke and doesn't pass on the ESC key, or write a Message Filter that implements IMessageFilter to do the same thing. The keyboard hook is harder to write... The docs for the MessageFilter starts here[^]. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave, excuse me but can you explain me, what a keyboard hook is? :confused: tnx!;)
Night Soul!!!
-
Dave, excuse me but can you explain me, what a keyboard hook is? :confused: tnx!;)
Night Soul!!!
A keyboard hook is a function that you write and register with Windows using the SetWindowsHookEx API function. Basically, this function will be called every time the keyboard driver attempts to post a keyboard message to an input queue. You can see every keystroke message before it goes to an application. This function has a responsibility of passing along the data that the driver has given it to the next hook in the chain. (You can have multiple hooks attached, where each hook has to pass the data it receives to the next...) The cool part is you can manipulate the message data before it's passed to the next hook. Or, if you need to disable certain keys, DON'T pass the data to the next hook. Just return nothing... I've written hooks to disable the Windows Logo keys, eat certain keystrokes at certain times, and have even had a little fun, like 5 times a second, replace the WM_KEYDOWN message with a different key than was hit... Drives people nuts when they don't know you installed it! :-D RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
A keyboard hook is a function that you write and register with Windows using the SetWindowsHookEx API function. Basically, this function will be called every time the keyboard driver attempts to post a keyboard message to an input queue. You can see every keystroke message before it goes to an application. This function has a responsibility of passing along the data that the driver has given it to the next hook in the chain. (You can have multiple hooks attached, where each hook has to pass the data it receives to the next...) The cool part is you can manipulate the message data before it's passed to the next hook. Or, if you need to disable certain keys, DON'T pass the data to the next hook. Just return nothing... I've written hooks to disable the Windows Logo keys, eat certain keystrokes at certain times, and have even had a little fun, like 5 times a second, replace the WM_KEYDOWN message with a different key than was hit... Drives people nuts when they don't know you installed it! :-D RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
thanks for the lesson!!!;) well done!:-D
Night Soul!!!