【文件属性】:
文件名称:delphi_钩子截获鼠标操作
文件大小:194KB
文件格式:RAR
更新时间:2014-02-14 04:10:48
delphi_钩子截获鼠标操作
var
Form1: TForm1;
Hook:HHOOK;
PlayHook:HHOOK;
PlayLog:Integer;
EventLog:Integer;
EventArr:array[0..1000]of EVENTMSG; //记录鼠标时间
bDelay:Bool;
implementation
{$R *.dfm}
function HookProc(iCode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;
begin
Result:=0;
if iCode < 0 then
Result := CallNextHookEx(Hook,iCode,wParam,lParam)
else if iCode = HC_SYSMODALON then //不允许回放
//
else if iCode = HC_SYSMODALOFF then //允许回放
//
else if (iCode = HC_ACTION) then begin
EventArr[EventLog]:=pEventMSG(lParam)^; //把鼠标动作存入缓冲区
EventLog:=EventLog+1; //缓冲区指针加1
if EventLog>=1000 then begin
UnHookWindowsHookEx(Hook);
end;
end;
end;
function HookPlayBack(iCode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;
begin
Result:=0;
if iCode<0 then CallNextHookEx(PlayHook,iCode,wParam,lParam)
else if iCode = HC_SYSMODALON then //不允许回放
//
else if iCode = HC_SYSMODALOFF then //允许回放
//
else if (iCode=HC_GETNEXT) then begin
if bDelay then begin
bDelay:=False;
Result:=50;
end;
pEventMSG(lParam)^:=EventArr[PlayLog];
end
else if (iCode = HC_SKIP)then begin
bDelay := True;
PlayLog:=PlayLog+1;
end;
if PlayLog>=EventLog then begin
UNHookWindowsHookEx(PlayHook);
end;
end;
【文件预览】:
鼠标
----__history()
--------Mouse_Record.dfm.~8~(797B)
--------Mouse_Record.pas.~32~(3KB)
--------Mouse_Record.pas.~35~(3KB)
--------Mouse_Record.pas.~31~(3KB)
--------Mouse_Record.dfm.~10~(851B)
--------Mouse_Record.dfm.~4~(776B)
--------Mouse_Record.pas.~30~(3KB)
--------Mouse_Record.pas.~37~(3KB)
--------Mouse_Record.pas.~28~(3KB)
--------Mouse_Record.dfm.~9~(822B)
--------Mouse_Record.dfm.~7~(793B)
--------Mouse_Record.pas.~29~(3KB)
--------Mouse_Record.dfm.~6~(793B)
--------Mouse_Record.pas.~34~(3KB)
--------Mouse_Record.pas.~33~(3KB)
--------Mouse_Record.dfm.~3~(627B)
--------Mouse_Record.dfm.~5~(776B)
--------Mouse_Record.dfm.~11~(881B)
--------Mouse_Record.dfm.~12~(909B)
--------Mouse_Record.pas.~36~(3KB)
----MouseRecord.identcache(221B)
----MouseRecord.res(5KB)
----MouseRecord.dpr(247B)
----Mouse_Record.dfm(941B)
----MouseRecord.exe(404KB)
----MouseRecord.dproj(4KB)
----Mouse_Record.dcu(6KB)
----Mouse_Record.pas(3KB)
----MouseRecord.dproj.local(2KB)
网友评论
- 很有用,做鼠标钩子不错的参考。