Autor Beitrag
LonghornUser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mo 17.04.06 20:47 
Hallo,
ich erstelle mittels diesem Code systemweite HotKeys:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
{...}
  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 pressed !');
end;

procedure TForm1.FormCreate(Sender: TObject);
const
  MOD_CONTROL = 2;
  VK_A = $41;
begin
  // Registrierung Hotkey Ctrl + A
  id1 := GlobalAddAtom('Hotkey1');
  RegisterHotKey(Handle, id1, MOD_CONTROL, VK_A);
end;

// "Entregistrieren" der Hotkeys
procedure TForm1.FormDestroy(Sender: TObject);
begin
  UnRegisterHotKey(Handle, id1);
  GlobalDeleteAtom(id1);
end;

Nun ist mir durch die id-Variablen vorgeschrieben, wieviele HotKeys ich setzen kann (in diesem Fall einen). Aber eigentlich sollte es doch möglich sein, diese HotKeys dynamisch zu erzeugen (unendlich viele). Nur wie erstelle ich Integer Variablen zur Laufzeit ?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 17.04.06 20:50 
Nimm für die Speicherung der IDs einfach ein dynamisches Array of Integer.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mo 17.04.06 21:12 
Stimmt, das müsste gehen.
Dumme Frage: Wie stelle ich die Länge eines Arrays fest ? Also wieviele Elemente es hat ?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 17.04.06 21:21 
SetLength und Length ;-) Rest steht in der DOH *gg*

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.