alt tab and pausing the game

Blitz3D Forums/Blitz3D Beginners Area/alt tab and pausing the game

flying willy(Posted 2005) [#1]
Hi there,

When I alt tab out of blitz, or another application grabs focus, the blitz app keeps on running.

I would like to know how to detect this, and halt execution properly.

see http://www.blitzbasic.com/Community/posts.php?topic=43250 for more.


BlackD(Posted 2005) [#2]
hehe.. the beginners forum wouldn't be the place to ask. :) This is actually fairly technical - in Blitz alone, there's no way to detect this at all. Instead what you'd have to do is write a DLL which uses GDI32.DLL to detect when the blitz window ISN'T in focus (identifiable by the window handle) and in blitz code, to poll this constantly. As soon as the window isn't in focus, halt gameplay - and go into a delayed loop where it JUST checks to see if the Blitz window is in focus aain, and if it is, to resume gameplay.

Of course, if you're using full-screen Blitz3D, then there's no way to fix this. Don't alt-tab. :)

+BlackD


flying willy(Posted 2005) [#3]
This is full-screen, and is a problem for me because it keeps running!

Other applications often grab the focus as well... we need this solved!


wizzlefish(Posted 2005) [#4]
Incorporate a "pause" function, and it'll be the player's fault they didn't pause it first. You pause, then Alt+Tab.


fredborg(Posted 2005) [#5]
Look here: http://www.blitzbasic.com/codearcs/codearcs.php?code=853

It's very easy to do.


wizzlefish(Posted 2005) [#6]
That's really weird.

That function looks like it will do nothing. :D


flying willy(Posted 2005) [#7]
brilliant - thanks lads!

And very silly that blitz doesn't have a command for it.


(tu) ENAY(Posted 2005) [#8]
Just do what I do and be REALLY EVIL:-

if keydown alt = true and keydown tab = true then End

;)