WH_GETMESSAGE

Hi everyone,

I am developing a utility that intercepts keyboard messages (WM_KEYxx, WM_SYSKEYxx) and discards them by setting the message field to WM_NULL. This is supposed to effectively lock out the keyboard because I would like to prevent users from using the keyboard when my utility is running unless they have an unlock key. The problem is I am getting a runtime error when I close the application that has the input focus. The hook type I used is system wide. Is there a way to prevent Windows from sending the message to the destination window. Any help will be highly appreciated.

Thanks

Comments

  • : Hi everyone,
    :
    : I am developing a utility that intercepts keyboard messages (WM_KEYxx, WM_SYSKEYxx) and discards them by setting the message field to WM_NULL. This is supposed to effectively lock out the keyboard because I would like to prevent users from using the keyboard when my utility is running unless they have an unlock key. The problem is I am getting a runtime error when I close the application that has the input focus. The hook type I used is system wide. Is there a way to prevent Windows from sending the message to the destination window. Any help will be highly appreciated.
    :
    : Thanks
    :
    I find your application of a system hook a bit strange but nevertheless, a hook-procedure should be in a dll. All active applications will aut. load this library, in this way the procedure is mapped to the applications adressing space. If you haven't done this, this could be the problem.


  • Hi again,

    I have implemented the System wide hook in a DLL. What I would now like to do is to prevent the keyboard messages from reaching the destination window after intercepting them. What I have done is to change the message field to WM_NULL to indicate a blank message. Is there a way to discard the keyboard message so it cant be retrieved by the active application say Notepad even if it has focus.

    Thanx
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories