Autor Beitrag
JungerIslaender
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mi 22.10.08 17:36 
Hi Leute,

Ich möchte in mein Programm ein Hook einbauen, sodass die eingabe von STR+Y abgefangen wird und dann ein Prozess in meinem Programm gestartet wird. Ich hatte es schon mit einem Shortcut und der Actionlist versucht, dass Funktioniert leider nicht weil mein Programm nicht dass aktive Programm ist.

Ich habe mir natürlich verschieden Threads+Tutorials Angeguckt bin damit aber nicht zurecht gekommen. Deshalb bitte ich um Hilfe.

MFG JungerIslaender
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 22.10.08 17:44 
Dafür braucht man keinen Hook, für sowas nimmt man Suche in: Delphi-Forum REGISTERHOTKEY.

_________________
We are, we were and will not be.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mi 22.10.08 18:05 
Vielen Dank!!

Hab es jetzt so gelöst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
 procedure Hotkey(var Message: TMessage); message WM_HOTKEY;

implementation

const HK_CTRL_A: Cardinal = $ff + Ord('A');

procedure TForm1.FormActivate(Sender: TObject);
begin
 RegisterHotkey(Handle, HK_CTRL_A, MOD_CONTROL, HK_CTRL_A - $ff);
end;

procedure TForm1.Hotkey(var Message: TMessage);
begin
 if (Message.LParamLo = MOD_CONTROL) and (Message.LParamHi = HK_CTRL_A - $ff) then begin
  // do what you want
  end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 UnregisterHotkey(Handle, HK_CTRL_A);
end;