Search

'HotKey'에 해당되는 글 1건

  1. 2008.06.23 Delphi - Hotkey

Delphi - Hotkey

Programming/Delphi 2008.06.23 00:20 Posted by 파란크리스마스

출처 : http://www.swissdelphicenter.ch/torry/showcode.php?id=147

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
 if Msg.HotKey = id1 then
   ShowMessage('Ctrl + A 선택!');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  // 키 등록 Ctrl + A 
  id1 := GlobalAddAtom('Hotkey1');
  RegisterHotKey(Self.Handle, id1, MOD_CONTROL, $41); // $41 -> A
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  // 키 해제
  UnRegisterHotKey(Handle, id1);
  GlobalDeleteAtom(id1);
end;

end.

신고
TAG ,


 

티스토리 툴바