Jump to content
  • Advertisement


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


Losing the keyboard

This topic is 5932 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 Direct Input in my app and i''m running windowed mode. Everytime i try to run the app in the background it loses the keyboard. Does anyone know why? CooperativeLevel flags are DISCL_FOREGROUND and DISCL_NONEXCLUSIVE

Share this post

Link to post
Share on other sites
did it ever occur to you that DISCL_FOREGROUND cooperative mode might not be compatible with background execution? read the getting started with di part of the docs and try again.

Come to #directxdev IRC channel on AfterNET

Share this post

Link to post
Share on other sites
I assume the problem is that your app will not read the keyboard once it returns to the foreground.

You will need to reacquire the keyboard device when the application gets focus again.

The usual way of checking for this is on the Poll command. If DIERR_NOTACQUIRED is returned then issue the Acquire command for the device. eg.
hr = pKeyboard->Acquire();

This should reacquire the device and you can re-issue the Poll command to get your keyboard data.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!