Autor Beitrag
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 07.09.08 10:25 
Hallo.

Ich habe ein Problem:
Ich habe im Forum den folgenden Code gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure keylogger;
var i: integer;
begin
  while true do
  begin
    for i := 10 to 200 do
      if boolean(getasynckeystate(i)) then
        form1.memo1.lines.Text :=
        form1.Memo1.lines.Text + char(i);
    sleep(10);
  end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var tid: cardinal;
begin
  createthread(0,0,@keylogger,nil,0,tid);
end;
und zwar hier: www.delphi-forum.de/....php?p=519810#519810

Ich möchte also mit getasynckeystate Tasten abfragen. Ich will diesen Code nicht eins zu eins übernehmen, aber ich benutze ihn um ein bisschen zu experimentieren. Dabei ist mir aufgefallen, dass ich damit nicht herausbekomme, ob der Buchstabe gerade groß oder klein geschrieben wurde.
Wie kann ich denn das herausbekommen?

Danke,
Matze

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 07.09.08 10:37 
Hi,

naja, ist ja klar, dass es nicht auf groß/klein achtet, da es ja nur den Zustand der Taste übermittelt. Du musst halt gucken, ob Shift(#16), Strg((#17), Alt(#18 ) gedrückt wird. Oder CapsLock

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 07.09.08 10:41 
ok klar.

Nur leider wird nur einmal übermittelt, wenn SHIFT gedrückt wird. Wenn der Benutzer also mehrere GROSSbuchstaben hintereinander eingibt, dann geht es wieder nicht.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 07.09.08 10:47 
wie ich sehe, scheint das wie bei CapsLock über GetKeyBoardState zu funktionieren (Quelle)

Edit:
Delphi-Hilfe hat folgendes geschrieben:
You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right.


Edit2:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Timer1Timer(Sender: TObject);
var C: String;    A: integer;
begin
  for A:= 65 to 122 do
    if bool(GetAsyncKeyState(A)) then
      begin
        C:=chr(A);
        if not bool(GetAsyncKeyState(VK_Shift)) then
          C:=AnsiLowerCase(C);
        LabeledEdit1.Text:=LabeledEdit1.Text+C;
      end;
end;

so gehts ganz gut

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 07.09.08 11:21 
Hey Danke!
Das klappt.

Warum bin ich da nicht drauf gekommen? Hach. Ich werd alt...

Danke nochmals an alle!

_________________
In the beginning was the word.
And the word was content-type: text/plain.