解释下代码..HOOK的
unit Unit1;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
hook:Hhook;
function Keyhook(nCode: Integer;wParam:WPARAM;lParam:Lparam):LRESULT;stdcall;
begin
beep;
Result:=CallNextHookEx(hook,nCode,wParam,lParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
hook := SetWindowsHookEx(WH_KEYBOARD,Addr(Keyhook),HInstance,GetCurrentThreadID);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnhookWindowsHookEx(hook);
end;
end.
我运行的时候没有出现错误,小弟我正在练习HOOK,希望高手给小弟讲一下代码是什么意思?