Autor Beitrag
Peter_Lustig
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31



BeitragVerfasst: Di 03.05.05 12:47 
Hallo, ich habe da mal eine Frage, weiß einer von euch, wie ich die Tastatur ansprechen kann, z.B.: das ich ein Bild mit den Courortasten verschieben kann. Mit den Tasten "Alt, Strg, Shift" klappts ja aber mit anderen Tasten nicht.
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: Di 03.05.05 12:59 
du musst mit der tastatur das programm ansprechen also den tastenstatus abfragen.
wie wäre es denn mit einem thread in dem ein kleines delay von 10 - 50 ms drin ist, damit geht das wunderbar 8)
Peter_Lustig Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31



BeitragVerfasst: Di 03.05.05 13:07 
Na und wie frage ich den Tastaturstatus ab???
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: Di 03.05.05 13:11 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure keycheck;
begin
  while true do
    begin
      if boolean(getasynckeystate(vk_left)) then
        form1.button1.left:= form1.button1.left - 1; 
      if boolean(getasynckeystate(vk_right)) then
        form1.button1.left:= form1.button1.left + 1; 
      if boolean(getasynckeystate(vk_up)) then
        form1.button1.top:= form1.button1.top - 1; 
      if boolean(getasynckeystate(vk_down)) then
        form1.button1.top:= form1.button1.top + 1; 
      sleep(50); //je kleiner desto schneller die bewegung
    end;
end;


und im form1.create:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  tid: cardinal;
begin
  createthread(nil, 0, @keycheck, nil, 0, tid);
end;

sollte funktionieren 8)
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Di 03.05.05 13:15 
Den Statusabfragen?? Meinst Du die Tasten die gedrückt wurden oder eine Tastendrucksimulieren. Ist grad unverständlich für mich. Wenn es um die Tasten gehet die gedrückt wurden, dann nur die über Deiner Form oder Systemweit?

_________________
Gruß Harry
Et spes me per dies sine te ducat et amor me ferat, si dolor spem tollit.
Peter_Lustig Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 31



BeitragVerfasst: Di 03.05.05 13:18 
Danke, hat auch Funktioniert.