记录键盘和鼠标的动作?然后保存下来?
解决方案 »
- 两个集合中有相同的元素,如何区分他们?
- 问调用存储过程中的参数转换问题?
- sql语句求救?server sql97....
- 关于文件操作的问题!!!!!!!!!!!!!???????????????????????????????
- 如何读取动态combobox的内容
- 哪里有delphi6 service pack 1下载啊?
- 请问formshow的setfocus的问题
- 可怕的问题:窗口在win98下变大了!
- HELP!!!DELPHI中串口控制如何传输二进制信息
- 小弟最近装上delphi5,为什么控件图标乱了,有没有方法解决?
- 各位老大,能不能帮帮我啊,救命了阿.每道题300分!!!
- 关于模糊查询的问题.急!
uses
windows;{$R *.res}
var
hhk1,hhk2:hhook;////////////////
procedure saveit(wparam,lparam:integer;mouseorkeyboard:boolean);
begin
// 在这里写保存的代码。
end;
function mousehookproc(ncode:smallint;wparam,lparam:integer):integer;stdcall;
begin
result:=0;
try
save(wparam,lparam,true);
finally
if ncode<0 then
result:=callnexthookex(hhk2,ncode,wparam,lparam);
end;end;
function keyboardhookproc(ncode:smallint;wparam,lparam:integer):integer;stdcall;
begin
try
result:=0;
save(wparam,lparam,false);
finally
if ncode<0 then
result:=callnexthookex(hhk1,ncode,wparam,lparam);
end;
end;
procedure endhook;stdcall;
begin
unhookwindowshookex(hhk1);
unhookwindowshookex(hhk2);end;
procedure beginhook;stdcall;
begin
hhk1:=setwindowshookex(WH_KEYBOARD,@keyboardhookproc,hinstance,0);
hhk2:=setwindowshookex(WH_MOUSE,@mousehookproc,hinstance,0);
end;exports
beginhook,
endhook;
end.
///////////////////////////////////////////////////////
unit Main;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;implementation
uses
debug_san;
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
h:cardinal;
proc:tprocedure;
begin
h:=loadlibrary('hook.dll');
try proc:=getprocaddress(h,'beginhook'); proc; finally
freelibrary(h);
end;end;procedure TForm1.Button2Click(Sender: TObject);
var
h:cardinal;
proc:tprocedure;
begin
h:=loadlibrary('hook.dll');
try
proc:=getprocaddress(h,'endhook');
proc;
finally
freelibrary(h);
end;end;
end.