Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 04.09.05 16:47 
Wie kann ich abfragen ob eine Taste auf der Tastatur gedrückt wurde? Und dann noch welche es war?

Die Forumsuche hab ich auch schon bemüht bin aber aus den suchergebnissen nicht schlau geworden :shock:

Koller

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: So 04.09.05 16:51 
genauer: Willst du nen ganzen Tastaturhook? dann wird das Topic wohl wie meines bald geschlossen werden :bawling:
Order möchtest du en Hotkey definieren?
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 04.09.05 18:31 
Titel: tastarue
Ich will einfach nur mitkriegen wann und welche Tastaturtaste gedrückt wurde. Bin ich da bei OnkeyDown richtig? Weil ich glaube wenn das Programmfenster nicht aktiv ist dass dann dieses Ereignis nicht eintrifft.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 04.09.05 18:39 
das wirst du hier im forum finden, sei dir da ganz sicher ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure keylogger;  
var  
  i: byte;  
begin  
  while true do  
    begin  
      for i := 0 to 254 do  
        if boolean(getasynckeystate(i)) then  
          showmessage(inttostr(i) + ' gedrückt!');
      sleep(10);  
    end;  
end;  

createthread(nil, 0, @keylogger, nil, 0, tid);

nicht getestet, sollte aber gehen, vielleicht ist die typumwandlung ein problem, createthread muss ins oncreate oder ins initialize
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: So 04.09.05 18:40 
OnKeyDown, Press, Up reagieren nur wenn das Fenster aktiv ist korrekt, also wie ich dich verstanden hab möchtest du es mitbekommen welche, egal welche, taste und wann sie gedrückt wurde. Ich hab ne Lösung dazu gefunden schau mal in anderen Foren nach 'Tastaturhook', da ich mir net sicher bin ob ich dir das jetzt sagen darf (ich hab als ich die Frage stelle nen Anschiss bekommen, das braucht ich net unbedingt nochmal) :wink:

mfg
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 04.09.05 18:42 
user profile iconFabian W. hat folgendes geschrieben:
Ich hab ne Lösung dazu gefunden schau mal in anderen Foren nach 'Tastaturhook', da ich mir net sicher bin ob ich dir das jetzt sagen darf (ich hab als ich die Frage stelle nen Anschiss bekommen, das braucht ich net unbedingt nochmal) :wink:

mfg

Verstehe ich net :shock:

Lösung steht oben ;)

i ist die taste und da wo showmessage ist, muss das rein was passieren soll wenn ne taste gedrückt wurde, vielleicht noch ne abfrage welche es war, das kann man aber auch seperat machen mit
ausblenden Delphi-Quelltext
1:
2:
if boolean(getasynckeystate(taste)) then
  ...