Minimizing full screen game

Blitz3D Forums/Blitz3D Beginners Area/Minimizing full screen game

CGV(Posted 2003) [#1]
I've been trying to minimize a full screen game by calling ShowWindow(hwnd, SW_MINIMIZE) but the app doesn't minimize it just disappears. I also tried it using SetWindowPlacement and got the same result.

I have to then hit Ctrl-Alt-Del and terminate the app from there.

Is it not possible to programmically minimize a Blitz app?
I've done it in my C directX games so I know these functions work.


jfk EO-11110(Posted 2003) [#2]
Problem is when it runs in Fullscreen and you simply minimize it, DirectX is running windows still in Fullscreen Mode, say no taskbar, no desktop. If you minimze it now, the next window will become visible, which is usually the IDE and not the Desktop.

Since the minimized BLitz app is still running in the Fullscreenmode, only minimized, it is also in a single Task Mode and will pause and give the focus to the ide, in other words you need to kill this process manually.

When you are in windowed Mode you can easily minimize the window correctly, eg by using:

PostMessage(hWnd,WM_SYSCOMMAND,SC_MINIMIZE,0)
Delay 2000
PostMessage(hWnd,WM_SYSCOMMAND,SC_RESTORE,0)

Are you shure you used to minimize a Fullscreen in C?

There is a dirty trick to minimize a Fullscreen app: simply run any other program, eg: execfile "command /c" . this will minimize the app, but unfortunately the app seems to be frozen after maximizing it again.


CGV(Posted 2003) [#3]
Yes, I've definately done it in C by simply calling ShowWindow() and it always worked. By the way I've also got the neccessary code in my C apps to handle Alt-Tabbing out so maybe that makes the difference. I've never tested them under anything but Win 98SE so maybe I just got lucky. I've never released any of my games because I never finished any of them :)

I tried the dirty trick you mentioned and it worked fine.
The app didn't freeze at all after I maximized it again. I'm using BlitzPlus but as Blitz2D but again, maybe it only works under 98SE.

In leu of minimizing the app, how do Blitz shareware authors handle the need to launch a web browser when their user's click the register link in their games?


jfk EO-11110(Posted 2003) [#4]
It is always a good Idea to switch to windowed Mode before an other exe is called, because only the windowed mode will allow cross-app multithreading. Only system-hooking tasks like antivirus apps or firewalls or any other low level interrupt-driven TSRs can run in the background of a fullscreen Blitz App AFAIK.
The problem with switching to windowed Mode is all Graphics and Fonts get "lost" because Blitz performs an Endgraphics automaticly. So if you want to continue the App/Game after switching back to Fullscreen then you might have to reload everything. If you have a nice LoadAll() Function, or maxbe a Save- and Load-Game Function that can save any Stage of a Game then it isn't a problem.

BTW: If you want to start an external Exe and then End the running App, the only way is to switch to Windowed Mode, then ExecFile the File, then End. It is a good idea to ask windows what resolution the Desktop is running, then use this Size for the window size, so there will only the Borders popup. Many commercial Games do this as well.


CGV(Posted 2003) [#5]
If BlitzPlus apps can handle being Alt-Tabbed out of, I would think they can also be minimized without any problems, after all minimization is what happens when you alt-tab a full screen game.

Go to this page: (Click here) and download the small file there if you want to see my DirectX app in C that minimizes by calling ShowWindow().

This is the very first DirectX app I wrote to learn how to use DirectDraw. It requires DirectX 7. 800x600x16

It's not a game so there's nothing to do but watch as it flies a little plane across the screen (poorly :)).

If you press the space key the fullscreen app will minimize, then just click the taskbar icon to maxmize it again and you'll see the app resumes right where it left off with no problems.

Hit the escape key to exit.

But as I said, I've only tested it on Win 98SE so perhaps it doesn't work universally. Try it at your own risk.

(The link is temporary, I'm going to take it down in about a week.)


jfk EO-11110(Posted 2003) [#6]
Well, I believe this anyway :)


CGV(Posted 2003) [#7]
Okay, I'm just gonna make my game windowed and that settles the matter :)


darklordz(Posted 2003) [#8]
Check this
Graphics3D 640,480,32,1
SetBuffer BackBuffer()

App=GetActiveWindow()

Delay 2000
ShowWindow(App,0) ; hide teh window and activate another
; Launch other app here
; Send this windows hwnd parameter as cmdline par to the other app. then use winapi to Show the window again (ShowWindow(Hwnd,5))

While Not KeyHit(1)
	RenderWorld
	UpdateWorld
	Flip
Wend



CGV(Posted 2003) [#9]
Excellent, thanks darklordz,

That second ShowWindow call was what I was missing, although i'm passing a 6 for the nCmdShow parameter to just force the task bar icon to appear.

One question though, what's the point to passing the window's handle to the external app which in my case would be a web browser? I can't imagine it would be able to put it to any use, and I find it works without it.

Regards,


darklordz(Posted 2003) [#10]
Aaah, Well for nistance lets say you wanted to launch a windows config app. You could let that app "show" the game windows when you're done with it....


jfk EO-11110(Posted 2003) [#11]
Hey - darklordz example uses SW_HIDE - doesn't this hide the App? I mean, is it minimized or hidden after the call?


darklordz(Posted 2003) [#12]
using minimize the screen doesnt return to normal mode. So yes i hide it. that why you could possibly launch another app to show the window again...


CGV(Posted 2003) [#13]
using minimize the screen doesnt return to normal mode.


Is this also true of Blitz+ or just Blitz3D? If i'm not mistaken I think I saw some post's in these forums suggesting that Blitz+ does a better job of handling Alt-Tabbing than Blitz3D does.

After seeing your code I realized what my original error had been. I was passing the nCmdShow parameter as SW_MINIMIZE (literally) but I had failed to define it in my app so I was effectively passing a SW_HIDE so that's what my app was doing, hiding.

I tried doing this:
ShowWindow(app, 6)
ExecFile("register.htm")

and it works, it minimizes my full screen game and launches the web browser. Once I click the taskbar icon it maximizes the game and everthing's restored.


jfk EO-11110(Posted 2003) [#14]
Ah, ok. But now please tell me does this also work from the Fullscreen Mode? This would be very useful.


darklordz(Posted 2003) [#15]
Yes it does...