Archived

This topic is now archived and is closed to further replies.

DirectInput : problem using devices immediately after Acquire()

This topic is 5595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites