Method WindowsHook.ThreadCallWndProc
Overload
Sets a WH_CALLWNDPROC hook for a thread of this process. See API SetWindowsHookEx.
public static WindowsHook ThreadCallWndProc(Action<HookData.ThreadCallWndProc> hookProc, int threadId = 0, bool setNow = true)
Parameters
|
hookProc (Action<HookData.ThreadCallWndProc>)
The hook procedure (function that handles hook events). Must return as soon as possible. The event cannot be canceled or modified. noteWhen the hook procedure returns, the pointer field of the parameter variable becomes invalid and unsafe to use. |
|
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
A new WindowsHook object that manages the hook. |
Exceptions
|
AuException
Failed. |
Examples
using var hook = WindowsHook.ThreadCallWndProc(x => {
ref var m = ref *x.msg;
WndUtil.PrintMsg(out var s, m.hwnd, m.message, m.wParam, m.lParam);
print.it(s, x.sentByOtherThread);
});
dialog.show("hook");