?? uhookcode.pas
字號:
unit UHookCode;
interface
uses windows, QStrings, Classes, Sysutils{, UShowWin};
function HookOn:Boolean;stdcall;
procedure HookOff;stdcall;
implementation
uses Controls, StdCtrls, Messages, UKeyInput;
var
HookH:HHook; //鉤子句柄
ifOpen:Boolean;
iH:Integer;
procedure GetCSHandle;
begin
iH:=FindWindow(nil,'Counter-Strike');
if iH=0 then iH:=FindWindow(nil,'strike');
if iH=0 then iH:=FindWindow(nil,'HL');
if iH=0 then iH:=FindWindow(nil,'Condition Zero');
if iH=0 then iH:=FindWindow('Valve001',nil);
end;
procedure ShowInput;
begin
if frmKeyInput=nil then
frmKeyInput:=TfrmKeyInput.Create(nil)
else frmKeyInput.Show;
end;
function keyhook(Code:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;
begin
if ifOpen then
begin
Result:=CallNextHookEx(HookH,code,Wparam,lParam);
Exit;
end;
Result:=1;
ifOpen:=True;
if (code=HC_ACTION) and (wParam=123) then ShowInput;
Result:=CallNextHookEx(HookH,code,Wparam,lParam);
ifOpen:=False;
end;
function HookOn:Boolean;
var
iP:Cardinal;
begin
GetCSHandle;
iP:=GetWindowThreadProcessId(iH,nil);
HooKH:=SetWindowsHookEx(WH_KEYBOARD,keyHook,HInstance,iP);
Result:=HookH<>0;
ifOpen:=False;
end;
procedure HookOff;
begin
UnHookWindowsHookEx(HookH);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -