Autor Beitrag
pRoTeUs
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 47

Windows XP prof
Delphi 2005 prof
BeitragVerfasst: Do 13.10.05 14:20 
Hallo allerseits!

Also ich habe da folgendes Problem:

Ich möchte über MMSystem den Joystick verwenden.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
var JInfo: TJoyInfo;
begin
  JoyGetPos(JOYSTICKID1, @JInfo);
  Label1.Caption:='X-Achse: '+IntToStr(JInfo.wXpos);
end;

Wenn ich das wie oben mit JoyGetPos mache, funktioniert es problemlos, und zeigt je nach Joystickstellung einen Wert zwischen 0 und 65000 an.
Da ich aber zum Beispiel auch das Ruder nutzen möchte, verwende ich die JoyGetPosEx.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
var JInfo: TJoyInfoEx;
begin
  JoyGetPosEx(JOYSTICKID1, @JInfo);
  Label1.Caption:='X-Achse: '+IntToStr(JInfo.wXpos);
end;


Und das funktioniert dann schon nicht. Hab mich jetzt grad 1,5 Stunden durchs MSDN gekämpft, bin aber nicht weiter gekomen. Er compiliert das ganze und macht auch keine Probleme, aber reagiert halt einfach nicht auf den Joystick. Das heisst es steht immer sowas wie 'X-Achse: 20004323544' da.

Hat irgendjemand eine Idee was da nicht stimmt?

mfg
proteus
thlanger
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 02.11.05 08:37 
Hallo,
ich hatte das gleiche Problem, hier die Lösung:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  myjoyex : tJoyInfoEx;
begin
  myjoyex.dwSize:=sizeof(myjoyex);   // Größe des Feldes eintragen
  joyGetPosEx(joystickid1,@myjoyex);
end;


Ich hoffe das hilft....

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
pRoTeUs Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 47

Windows XP prof
Delphi 2005 prof
BeitragVerfasst: Fr 04.11.05 23:32 
Perfekt. Funktioniert so wie es soll.
Vielen Dank. :beer:

Mfg
proteus