Skip to content

Support for stopping other hooks for receiving keystroke notifications #52

@c-giannoulis

Description

@c-giannoulis

It would very useful to implement the return code for the hooks to stop certain keystrokes for monitored keyboards reaching also the standard input.
My use case is that a barcode scanner input get captured but the input also arrives on the System.in InputStream too.
An R/W marker method setHandled(), or stopProcessing() could indicate that the CallNextHookEx() should be bypassed for this iteration.

ref: https://learn.microsoft.com/en-us/windows/win32/winmsg/lowlevelkeyboardproc

If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.

If nCode is greater than or equal to zero, and the hook procedure did not process the message, it is highly recommended that you call CallNextHookEx and return the value it returns; otherwise, other applications that have installed WH_KEYBOARD_LL hooks will not receive hook notifications and may behave incorrectly as a result.

If the hook procedure processed the message, it may return a nonzero value to prevent the system from passing the message to the rest of the hook chain or the target window procedure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions