64 lines
1.2 KiB
ObjectPascal
64 lines
1.2 KiB
ObjectPascal
unit frmHotkeyExUnit;
|
|
|
|
{$mode delphi}
|
|
|
|
interface
|
|
|
|
uses
|
|
windows, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, cefuncproc;
|
|
|
|
type
|
|
|
|
{ TfrmHotkeyEx }
|
|
|
|
TfrmHotkeyEx = class(TForm)
|
|
Button1: TButton;
|
|
Button2: TButton;
|
|
Button3: TButton;
|
|
edtHotkey: TEdit;
|
|
Label1: TLabel;
|
|
procedure Button3Click(Sender: TObject);
|
|
procedure edtHotkeyKeyDown(Sender: TObject; var Key: Word;
|
|
Shift: TShiftState);
|
|
private
|
|
{ private declarations }
|
|
public
|
|
{ public declarations }
|
|
newhotkey: tkeycombo;
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
{ TfrmHotkeyEx }
|
|
|
|
procedure TfrmHotkeyEx.edtHotkeyKeyDown(Sender: TObject; var Key: Word;
|
|
Shift: TShiftState);
|
|
var i: integer;
|
|
begin
|
|
if newhotkey[4]=0 then
|
|
begin
|
|
for i:=0 to 4 do
|
|
if newhotkey[i]=0 then
|
|
begin
|
|
newhotkey[i]:=key;
|
|
break;
|
|
end else
|
|
if newhotkey[i]=key then break;
|
|
end;
|
|
|
|
edtHotkey.Text:=ConvertKeyComboToString(newhotkey);
|
|
end;
|
|
|
|
procedure TfrmHotkeyEx.Button3Click(Sender: TObject);
|
|
begin
|
|
ZeroMemory(@newhotkey, sizeof(newhotkey));
|
|
edtHotkey.Text:=ConvertKeyComboToString(newhotkey);
|
|
end;
|
|
|
|
end.
|
|
|