Spg ang.. Hotkeys
Virker perfekt, men jeg får nogle warnings?:[Warning] Unit1.pas(31): Comparing signed and unsigned types - widened both operands
Spg. 2 hvordan kan jeg opfange hvilken tast der bliver trykket på ? har fundet ud at tast A har værdien 65 så jeg kan skrive Registerhotkey(Handle, ALT_A, MOD_ALT, 65); hvordan finder jeg værdien på de andre taster på mit keyboard? som f.eks de extra taster(play, pause, vloume osv.) som logitech keyboards har.
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
ALT_A, ALT_B : THandle;
procedure WMHOTKEY(var message: TMessage); message WM_HOTKEY;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHOTKEY(var message: TMessage);
begin
if message.wParam = ALT_A then ShowMessage('ALT + A')
else if message.wParam = ALT_B then ShowMessage('ALT + B')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ALT_A := GlobalAddAtom('test_ALT_A');
ALT_B := GlobalAddAtom('test_ALT_B');
Registerhotkey(Handle, ALT_A, MOD_ALT, Ord('A'));
Registerhotkey(Handle, ALT_B, MOD_ALT, Ord('B'));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotkey(Handle, ALT_A);
UnRegisterHotkey(Handle, ALT_B);
GlobalDeleteAtom(ALT_A);
GlobalDeleteAtom(ALT_B);
end;
end.
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
ALT_A, ALT_B : THandle;
procedure WMHOTKEY(var message: TMessage); message WM_HOTKEY;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHOTKEY(var message: TMessage);
begin
if message.wParam = ALT_A then ShowMessage('ALT + A')
else if message.wParam = ALT_B then ShowMessage('ALT + B')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ALT_A := GlobalAddAtom('test_ALT_A');
ALT_B := GlobalAddAtom('test_ALT_B');
Registerhotkey(Handle, ALT_A, MOD_ALT, Ord('A'));
Registerhotkey(Handle, ALT_B, MOD_ALT, Ord('B'));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotkey(Handle, ALT_A);
UnRegisterHotkey(Handle, ALT_B);
GlobalDeleteAtom(ALT_A);
GlobalDeleteAtom(ALT_B);
end;
end.
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
ALT_A, ALT_B : THandle;
procedure WMHOTKEY(var message: TMessage); message WM_HOTKEY;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHOTKEY(var message: TMessage);
begin
if message.wParam = ALT_A then ShowMessage('ALT + A')
else if message.wParam = ALT_B then ShowMessage('ALT + B')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ALT_A := GlobalAddAtom('test_ALT_A');
ALT_B := GlobalAddAtom('test_ALT_B');
Registerhotkey(Handle, ALT_A, MOD_ALT, Ord('A'));
Registerhotkey(Handle, ALT_B, MOD_ALT, Ord('B'));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotkey(Handle, ALT_A);
UnRegisterHotkey(Handle, ALT_B);
GlobalDeleteAtom(ALT_A);
GlobalDeleteAtom(ALT_B);
end;
end.
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
ALT_A, ALT_B : THandle;
procedure WMHOTKEY(var message: TMessage); message WM_HOTKEY;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHOTKEY(var message: TMessage);
begin
if message.wParam = ALT_A then ShowMessage('ALT + A')
else if message.wParam = ALT_B then ShowMessage('ALT + B')
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ALT_A := GlobalAddAtom('test_ALT_A');
ALT_B := GlobalAddAtom('test_ALT_B');
Registerhotkey(Handle, ALT_A, MOD_ALT, Ord('A'));
Registerhotkey(Handle, ALT_B, MOD_ALT, Ord('B'));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotkey(Handle, ALT_A);
UnRegisterHotkey(Handle, ALT_B);
GlobalDeleteAtom(ALT_A);
GlobalDeleteAtom(ALT_B);
end;
end.