Joystick Detection problem with Win API
Posted on 1997-06-13
I have a SB16 with Joystick port in my pc, but no joystick attached to the port. My program checks for an attached joystick, otherwise it uses the mouse. To check if a joystick port exists, I use:
UINT NumDevices = joyGetNumDevs();
After this, NumDevices = 16. I have only one joystick port, should this not be 1?
Then I check to see which device is attached.
(Like shown in the win32 API Help file)
UINT Dev1Attached = joyGetPos(JOYSTICKID1,&joyinfo) != JOYERR_UNPLUGGED;
This gives no error, and the program thinks that 16 devices are avaiable and that device 1 is attached.