Losing the keyboard

Started by
1 comment, last by ZitherMan 21 years, 8 months ago
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
----------------------------
When hell freezes over it will be a pretty cool place to snowboard
Advertisement
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
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.

Cheers,
John
John ReynoldsCreative Asylum Ltdwww.creative-asylum.com

This topic is closed to new replies.

Advertisement