DirectInput : problem using devices immediately after Acquire()

Started by
0 comments, last by bobboberts 21 years, 8 months ago
I''m using DirectInput to get data from a Gravis joystick. I use code that''s copied right from the MS "joystick" sample to acquire the device and get data from the device. Everything works fine, except that if I call "GetDeviceState" immediately after calling "Acquire", I get junk data (all zeros on every axis and every button). I can call it literally 100000 times in a row, and I get the same junk data every time. Then suddenly - maybe half a second after calling Acquire() - the data is healthy and happy again, even though all I was doing that whole time was calling "GetDeviceState" over and over (and it was returning 0 (success)). Is there a minimum time that an application needs to wait after calling Acquire() before a device''s data is actually available? Has anyone else experienced this problem? Is there any other way to determine whether the data is valid in this case, so I can loop until I know the data is valid, or do I have to just sleep for a while after calling Acquire()? Thanks... -Dan
Advertisement
quote:Original post by bobboberts
...even though all I was doing that whole time was calling "GetDeviceState" over and over (and it was returning 0 (success)).


Are you just calling GetDeviceState, or are you polling the device as well? If you aren''t polling, you may need to. I''m guessing you are since the joystick sample does, but the sentence above suggests you aren''t so I just thought I''d check.

This topic is closed to new replies.

Advertisement