不就是屏蔽Win或者Ctrl+Esc
library KeyHook;
uses
Windows,Messages,SysUtils,
Classes;
const
AlTIsDownFlags=$20;
type
PKeyBoardLLStruct=^TKeyBoardLLStruct;
TKeyBoardLLStruct=record
VCode
WORD;
ScanCode
WORD;
Flags
WORD;
Time
WORD;
dwExtroInfo
WORD;
end;
var
MyHook,HookHandle:HHook;
keyPress:boolean;
{$R *.res}
//屏蔽低级键盘
function KeyLLHookProc(icode:integer;wparam:Wparam;lparam:LPARAM):LRESULT;stdcall;
var
P
KeyBoardLLStruct;
begin
result:=0;
if icode=HC_ACTION then
begin
case wparam of
WM_KEYDOWN,
WM_KEYUP,
WM_SYSKEYDOWN,
WM_SYSKEYUP:
begin
p:=PKeyBoardLLStruct(lparam);
keyPress:= (P.VCode=VK_LWIN) or (P.VCode=VK_RWIN) or
((P.VCode=VK_ESCAPE) and ((GetKeyState(VK_CONTROL) and $8000)<>0)) ;
if KeyPress then
result:=1;
end;
end;
end
else
CallNextHookEx(MyHook,icode,wparam,lparam);
end;
function InstallKeyHook:bool;stdcall;export;
begin
MyHook:=0;
MyHook:=SetWindowsHookEx(13{WH_KEYBOARD_LL},@KeyLLHookProc,Hinstance,0);
result:=(MyHook<>0);
end;
function UnInstallKeyHook:bool;stdcall;export;
begin
result:=UnHookWindowsHookEx(MyHook);
MyHook:=0;
end;
exports
InstallKeyHook,UnInstallKeyHook;
end.