unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
BtnInstall: TButton;
BtnUninstall: TButton;
procedure BtnInstallClick(Sender: TObject);
procedure BtnUninstallClick(Sender: TObject);
private
{ Private-Deklarationen }
HotKeySet,
HotKeySet2 : Boolean;
procedure WMHotKey(
var Message:TMessage);
message WM_HotKey;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
HotKeyID = $0001;
GlobalHotkey_ID_Test = $0002;
procedure TForm1.WMHotKey(
var Message:TMessage);
begin
case Message.wParam
of
HotKeyID : ShowMessage('
Hotkey 1');
GlobalHotkey_ID_Test : ShowMessage('
Hotkey 2');
end;
end;
procedure TForm1.BtnInstallClick(Sender: TObject);
begin
HotKeySet := RegisterHotKey(
Handle, HotKeyID, MOD_SHIFT, VK_F1);
//HotKeySet is Boolean
HotKeySet2 := RegisterHotkey(
Handle, GlobalHotkey_ID_Test, MOD_Alt, VK_F2);
//HotKeySet2 is auch n Boolean
end;
procedure TForm1.BtnUninstallClick(Sender: TObject);
begin
HotKeySet := UnregisterHotKey(
Handle, HotKeyID);
HotKeySet2 := UnregisterHotKey(
Handle, GlobalHotkey_ID_Test);
end;
end.