Article ID: 133065
Article Last Modified on 11/1/2006
int JoysticksConnected( )
{
// determine number of joysticks installed in Windows 95
JOYINFOEX info; // extended information
int njoyId = 0; // 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
Additional query words: 4.00 JOYERR connect kbinf
Keywords: KB133065