Method WindowsHook.ThreadKeyboard
Overload
Sets a WH_GETMESSAGE hook for a thread of this process. See API SetWindowsHookEx.
public static WindowsHook ThreadKeyboard(Func<HookData.ThreadKeyboard, bool> hookProc, int threadId = 0, bool setNow = true)
Parameters
hookProc (Func<HookData.ThreadKeyboard, bool>)
The hook procedure (function that handles hook events).
Must return as soon as possible.
If returns |
threadId (int)
Native thread id, or 0 for this thread. The thread must belong to this process. |
setNow (bool)
Set hook now. Default |
Returns
WindowsHook
New WindowsHook object that manages the hook. |
Exceptions
AuException
Failed. |
Examples
using var hook = WindowsHook.ThreadKeyboard(x => {
print.it(x.key, 0 != (x.lParam & 0x80000000) ? "up" : "", x.lParam, x.PM_NOREMOVE);
return false;
});
dialog.show("hook");