hookunt.pas

来自「絮语2007视频聊天软件源程序.仅供参考」· PAS 代码 · 共 50 行

PAS
50
字号
unit hookunt;

interface

uses
  Windows,SysUtils,Classes;

type
  Thook=class
    public
     procedure starthook;
     procedure stophook;
     function getstatusout:boolean;
  end;

var
  lastertime:Tdatetime;
  Hookhwnd:Integer;

implementation
uses shareunit;

//------------------------------------------------------------------------------
// hook 处理过程
//------------------------------------------------------------------------------
function hookproc(icode:integer;wparam:wparam;lparam:lparam):lresult;stdcall;
begin
lastertime:=time;
result:=CallNextHookEx(Hookhwnd,icode,wparam,lparam);
end;


function Thook.getstatusout:boolean;
var h,m,s,ms:word;
begin
decodetime(time-lastertime,h,m,s,ms);
result:=h*3600+m*60+s>status_outtime*60;
end;

procedure Thook.starthook;
begin
Hookhwnd:=setwindowshookex(WH_JOURNALRECORD,hookproc,hinstance,0);  //安装钩子
end;

procedure Thook.stophook;
begin
unhookwindowshookex(Hookhwnd);//撤销钩子
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?