Delphi - Hotkey im System regsitrieren

 type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;
  public
    { Public-Deklarationen }
  end;

const id_SnapShot =101;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterHotKey(Form1.Handle,id_SnapShot,0,VK_Snapshot);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  UnRegisterHotKey(Form1.Handle,id_SnapShot);
end;

procedure TForm1.WMHotKey(var Msg : TWMHotKey);
begin
  { Die Drucktaste ändert den Fenstertitel }
  if Msg.HotKey = id_SnapShot then
    Form1.Caption := 'Test';
end;

 

2012-01-26T23:14:48 +0100, mail[at]michael[Bindestrich]puff.de