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
function MyHook(var Message:TMessage):Boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
function TForm1.MyHook(var Message: TMessage): Boolean;
begin
if (Message.Msg = $B016) and (Message.WParam = $5B) then
showmessage('OK');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.HookMainWindow(MyHook);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Application.UnhookMainWindow(MyHook);
end;
end.