Einzelnen Beitrag anzeigen

Benutzerbild von x000x
x000x

Registriert seit: 21. Jan 2004
Ort: Bei Hamburg
308 Beiträge
 
Delphi XE2 Professional
 
#2

Re: mehrere HotKey deklarationen

  Alt 19. Jun 2007, 20:40
Moin moin,

dein Problem muss woanders liegen, des was du gepostet hast, funktioniert.
Delphi-Quellcode:
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.
Peter
-= Gruss Peter =-
-= alias x000x =-
  Mit Zitat antworten Zitat