mirror of
https://github.com/nsnail/dot.git
synced 2025-06-17 21:13:21 +08:00
<fix> 钩子问题
This commit is contained in:
parent
8fa47065af
commit
4a75773bc4
@ -57,12 +57,14 @@ internal sealed class KeyboardHook : IDisposable
|
|||||||
|
|
||||||
private nint HookCallback(int nCode, nint wParam, nint lParam)
|
private nint HookCallback(int nCode, nint wParam, nint lParam)
|
||||||
{
|
{
|
||||||
if (nCode < 0 || wParam != Win32.WM_KEYDOWN) {
|
if (nCode >= 0 && wParam == Win32.WM_KEYDOWN) {
|
||||||
return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam);
|
var hookStruct = (Win32.KbdllhooksStruct)Marshal.PtrToStructure(lParam, typeof(Win32.KbdllhooksStruct))!;
|
||||||
|
if (KeyUpEvent?.Invoke(null, hookStruct) ?? false) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hookStruct = (Win32.KbdllhooksStruct)Marshal.PtrToStructure(lParam, typeof(Win32.KbdllhooksStruct))!;
|
return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam);
|
||||||
return KeyUpEvent?.Invoke(null, hookStruct) ?? false ? -1 : nint.Zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user