N
nullbert24
Unregistered / Unconfirmed
GUEST, unregistred user!
//键盘钩子过滤函数
function KeyHookProc(iCode: Integer; wParam: WPARAM ; lParam: LPARAM):LRESULT
; stdcall; export;
const KeyPressMask = $80000000;
begin
if iCode < 0 then
Result := CallNextHookEx(hOldKeyHook, iCode, wParam, lParam)
else begin
if ((lParam and KeyPressMask)= 0) then // 键按下
begin
Shared^.Keys[Shared^.KeyCount]:=Char(wParam and $00ff);
Inc(Shared^.KeyCount);
if Shared^.KeyCount>=BUFFER_SIZE-1 then Shared^.KeyCount:=0;
end;
iCode:=-1;
Result := CallNextHookEx(hOldKeyHook, iCode, wParam, lParam);
end;
end;
因为他是在SetWindowsHookEx(WH_KEYBOARD,KeyHookProc,HInstance,0);中调用
也没看见参数传递
首先,icode是干啥用的,iCode < 0是啥意思呢?
然后,wparam,lparam,lresult,他们各代表什么意义呢?
并且这个过滤函数有个BUG,不能按F12,为什么?
function KeyHookProc(iCode: Integer; wParam: WPARAM ; lParam: LPARAM):LRESULT
; stdcall; export;
const KeyPressMask = $80000000;
begin
if iCode < 0 then
Result := CallNextHookEx(hOldKeyHook, iCode, wParam, lParam)
else begin
if ((lParam and KeyPressMask)= 0) then // 键按下
begin
Shared^.Keys[Shared^.KeyCount]:=Char(wParam and $00ff);
Inc(Shared^.KeyCount);
if Shared^.KeyCount>=BUFFER_SIZE-1 then Shared^.KeyCount:=0;
end;
iCode:=-1;
Result := CallNextHookEx(hOldKeyHook, iCode, wParam, lParam);
end;
end;
因为他是在SetWindowsHookEx(WH_KEYBOARD,KeyHookProc,HInstance,0);中调用
也没看见参数传递
首先,icode是干啥用的,iCode < 0是啥意思呢?
然后,wparam,lparam,lresult,他们各代表什么意义呢?
并且这个过滤函数有个BUG,不能按F12,为什么?