C# windows app Keyboard hook SetWindowsHook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have to prevent user pressing Alt, Ctrl, Shift and Windows+M key combinations when the windows form created by the application is active. The main thread runs in background and the entire application is like a Wizard where user keeps on pressing Ok / Cancel and the next form is opened after closing the previous one

I have to prevent user from pressing all special keys, user should not be able to minimise the app etc

How do I do that

I tried SetWindowHookEx(...) but that did not work

Also in WinUser.h has
#define WH_KEYBOARD 2 an
#define WH_KEYBOARD_LL 1

The Hook can be created using WH_KEYBOARD but not WH_KEYBOARD_LL

The hook created using WH_KEYBOARD does not work.
Can some one help me in providing a small snippent of code

Thanks in advance
 
Back
Top