unit Unit1;
interface
uses
Forms, Messages, Windows;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure AppMessage(var Msg: tagMSG; var Handled: Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
procedure TForm1.AppMessage(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message = WM_HOTKEY) then
begin
MessageBox(Handle, 'Se pulsó ALT+TAB', '', 0);
Handled := true;
end;
end;
initialization
RegisterHotKey(Application.Handle, GlobalAddAtom('ALT+TAB'), MOD_ALT, VK_TAB);
finalization
UnregisterHotKey(Application.Handle, GlobalAddAtom('ALT+TAB'));
end.