Losing the keyboard
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
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
---
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement