【源码结构】
function LowLevelKeyboardProc(vNode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;
type
KbDllHookStruct = record
vkCode:DWord;
ScanCode:DWord;
Flags:DWord;
Time:DWord;
dwExtraInfo:DWord;
end;
var
P:^KbDllHookStruct;
begin
Result := 0;
P := Pointer(LPARAM);
if vNode = HC_ACTION then
begin
case wParam of
WM_KEYDOWN,WM_SYSKEYDOWN,WM_KEYUP,WM_SYSKEYUP:
if (p.vkCode = VK_F4) or (p.vkCode=VK_SHIFT)
or (p.vkCode=VK_TAB) or (p.vkCode=VK_MENU) or (p.vkCode=VK_CONTROL )
or (p.vkCode=VK_ESCAPE ) or (p.vkCode=VK_LWIN) or (p.vkCode=VK_RWIN)
or (p.vkCode=VK_RBUTTON) or (p.vkCode=VK_DELETE) then //判断按下键
begin
Result := 1;
end;
end;
if vNode <> 0 then
Result := CallNextHookEx(0,vNode,wParam,lParam);
end;
end;
评论