KEYMOUSU.PAS
资源名称:keymouse.zip [点击查看]
上传用户:whhglaser
上传日期:2007-01-04
资源大小:163k
文件大小:2k
源码类别:
钩子与API截获
开发平台:
Visual C++
- unit Keymousu;
- interface
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- Label6: TLabel;
- Label7: TLabel;
- Label8: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- Bevel1: TBevel;
- Label12: TLabel;
- Panel1: TPanel;
- Bevel3: TBevel;
- Label13: TLabel;
- Label14: TLabel;
- Label15: TLabel;
- Label16: TLabel;
- Bevel2: TBevel;
- Bevel4: TBevel;
- Bevel5: TBevel;
- Bevel6: TBevel;
- Bevel7: TBevel;
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- hinst: THANDLE;
- implementation
- {$R *.DFM}
- procedure TForm1.FormCreate(Sender: TObject);
- var
- proc:TFARPROC;
- begin
- show;
- if getModuleHandle('keydll.dll')<>0 then application.terminate;
- {cannot use close;}
- {only one exe}
- hinst:=LoadLibrary('keydll.dll');
- proc:=getprocAddress(hinst,'sethook');
- asm
- call proc
- end;
- end;
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- var
- proc:TFARPROC;
- begin
- proc:=getProcAddress(hinst,'unhook');
- asm
- call proc
- end;
- while getModuleUsage(hinst)>0 do
- freelibrary(hinst);
- end;
- end.