How to Detect Lost Focus.
Blitz3D Forums/Blitz3D Beginners Area/How to Detect Lost Focus.
| ||
Ok Im creating a game in full screen 3d mode... I want the game to END if the user trys to switch to another app using alt+tab or what not. So how do I detect when the app is suspended or losses focus???? |
| ||
you can either use api_HasFocus() -> if in focus = true or api_IsIconic(hwnd) -> if minimized = true (both commands come with user32.decls) cheers, chi |
| ||
Why would you want the game to end if the user switched screens? |
| ||
You do realize that lots of processes can cause your game to lose focus? I mean, things like virus checkers and instant messengers, those can momentarily steal the focus. |
| ||
I'm developing a VERY strictly enforced RPG. I want to prevent the use of other apps such as messengers so players can't use them to "unnaturally" cooridate attacks or otherwise be distracted from the RP. |