我有一个前辈给我的代码,我还没有看懂,你新开一贴,大家讨论一下吧(因为这个都掉底了,看到的人不会很多了)function LowLevelKeyboardProc(nCode:integer;WParam:WPARAM;LParam:LPARAM):LRESULT;stdcall; type KBDLLHOOKSTRUCT=record vkCode:DWORD; scanCode:DWORD; flags:DWORD; time:DWord; dwExtraInfo:dword; end; var fFlag:BOOL; p:^KBDLLHOOKSTRUCT; begin result:=0; fFlag := false; p:=Pointer(LPARAM); if (ncode=HC_ACTION) then begin case wparam of WM_KEYDOWN, WM_SYSKEYDOWN, WM_KEYUP, WM_SYSKEYUP: fFlag :=(p.vkCode = VK_Lwin) or (p.vkCode = VK_Rwin)or (p.vkCode = VK_apps); end; end; if fFlag = true then Result:=1; if ncode <> 0 then Result := CallNextHookEX(0,ncode,wparam,lparam); end;
关注!!
只差屏蔽Window键了,我已经查了以前所有贴子,还是没有找到,难道CSDN真的没有高人了!
type
KBDLLHOOKSTRUCT=record
vkCode:DWORD;
scanCode:DWORD;
flags:DWORD;
time:DWord;
dwExtraInfo:dword;
end;
var
fFlag:BOOL;
p:^KBDLLHOOKSTRUCT;
begin
result:=0;
fFlag := false;
p:=Pointer(LPARAM);
if (ncode=HC_ACTION) then
begin
case wparam of
WM_KEYDOWN,
WM_SYSKEYDOWN,
WM_KEYUP,
WM_SYSKEYUP:
fFlag :=(p.vkCode = VK_Lwin) or (p.vkCode = VK_Rwin)or (p.vkCode = VK_apps);
end;
end;
if fFlag = true then
Result:=1;
if ncode <> 0 then
Result := CallNextHookEX(0,ncode,wparam,lparam);
end;