1

Existing stack overflow question works great, except I need to prevent the key press from going through. To quote the original author of the post:

If you for some reason want to intercept system keys (creating e.g. Alt+Tab replacement) and preventing windows of handling them you must change the BeginInvoke to Invoke. Also adding Handled property to KeyDown, KeyUp events to see if it is being handled. After that you either call the CallNextHookEx or not.)

I apologize for my ignorance but I do not know how to handle this. Can anyone point me in the right direction for making these modifications? I am willing and able to learn, just not sure where to start.

Community
  • 1
  • 1

1 Answers1

0

If you don't want other apps to see the keys, don't invoke CallNextHookEx.

Per MSDN documentation on this Win32 call,

Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.

Judah Gabriel Himango
  • 58,906
  • 38
  • 158
  • 212