unit UHotKey;

interface

uses
  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 }
  procedure WMHotKey(var a: TWMHotKey); message WM_HOTKEY;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses UHotKey2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 RegisterHotKey(Handle,25,MOD_ALT or MOD_CONTROL, ord('T'));
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 UnRegisterHotKey(Handle,25);
end;

procedure TForm1.WMHotKey(var a: TWMHotKey);
var S: string;
begin
  if a.HotKey=25 then begin
   DateTimeToString(S, 'Сегодня dddd'#13'd mmmm yyy года'#13 +
                       'hh часов mm минут', Now);
   Form2.Label1.Caption := S;
   Form2.Visible := true;
   SetWindowPos(Form2.Handle, HWND_TOPMOST, 0, 0, 0, 0,
                   SWP_NOMOVE + SWP_NOSIZE);
  end;
end;

end.
