Ich bins nochmal!
Ich habe eben ein bischen mit den Funktionen rumprobiert.
Leider noch mit nur mäßigem Erfolg.
Ich habe aus dem MSDN diese Testfunktion:
Code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Label8->Caption=IntToStr(JoysticksConnected());
Label10->Caption=IntToStr(njoyId);
}
int JoysticksConnected( )
{ njoyId=0;
// determine number of joysticks installed in Windows 95
JOYINFOEX info; // extended information
// first joystick
int nConnected = 0; // goal - number of joysticks connected
MMRESULT dwResult; // examine return values
// Loop through all possible joystick IDs until we get the error
// JOYERR_PARMS. Count the number of times we get JOYERR_NOERROR
// indicating an installed joystick driver with a joystick currently
// attached to the port.
while ((dwResult = joyGetPosEx(njoyId++,&info)) != JOYERR_PARMS)
if (dwResult == JOYERR_NOERROR)
++nConnected; // the count of connected joysticks
return nConnected; // return the count of joysticks found
} // JoysticksConnected
Sie gibt aus, wieviele Joysticks sich im System befinden.
Außerdem kann man die Adresse, an der was gefunden wurde ja auslesen.
Es wurde angezeigt, dass ich einen Joystick habe (auch richtig) und dieser sich an der Adresse 2 befindet.
Soweit so gut, jetzt habe ich versucht die Koordinaten auszulesen.
Mit diesem Code:
JOYINFOEX *Zwei;
joyGetPosEx(2,Zwei);
Label6->Caption=IntToStr(&Zwei->dwPOV);
Leider wird egal, was ich abfrage nur eine 1 zurückgeliefert.
Wo liegt mein Fehler?
Mfg ACU
Lesezeichen