要求安装getmessage 钩子function abc … 怎么写?
begin
showmessage('123');
end;begin
SetWindowsHookEx(WH_Getmessage, @abc, HInstance, 0); / 怎么写?
end;怎么一直循环ABC这个过程.?abc函数的参数怎么写?.请测试好
begin
showmessage('123');
end;begin
SetWindowsHookEx(WH_Getmessage, @abc, HInstance, 0); / 怎么写?
end;怎么一直循环ABC这个过程.?abc函数的参数怎么写?.请测试好
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
icount : integer;
function abc(s : string): boolean; public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}function TForm1.abc(s: string): boolean;
begin
if s <> 'abc' then
begin
showmessage(s);
inc(icount);
if icount < 5 then
abc('123');
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
abc('123');
end;procedure TForm1.FormCreate(Sender: TObject);
begin
icount := 0
end;end.
function abc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;SetWindowsHookEx(WH_Getmessage, @abc, HInstance, 0);
begin
showmessage('123');
end;SetWindowsHookEx(WH_Getmessage, @abc, HInstance, 0);
abc有消息就会执行的