ExecFile in fullscreen

Blitz3D Forums/Blitz3D Programming/ExecFile in fullscreen

HappyCat(Posted 2006) [#1]
It seems to be common knowledge that calling ExecFile while in fullscreen mode does bad things to Blitz3D.

The advice I can find on here is either minimise your game before launching the URL (http://www.blitzbasic.com/Community/posts.php?topic=28345), or switch to a windowed mode before launching the URL.

However both of these are causing problems:

- Minimising the game causes the game to hang on the ShowWindow line. The game does minimise, but it never runs again.

- Changing to windowed mode causes the game's window to stay on top of everything else (including whatever you've just executed), which isn't very nice.

Neither of these are ideal (though I could live with switching to windowed mode if I had to).

So, I'm just wondering if anyone has managed to solve this is a more "polished" manner?


Pinete(Posted 2006) [#2]
I have the same problem!
:(


John Pickford(Posted 2006) [#3]
>- Changing to windowed mode causes the game's window to
>stay on top of everything else (including whatever you've
>just executed), which isn't very nice.

I just discovered that in Naked War. The new options page lets you switch modes. If you switch from Full to Windowed the window stays on top. Not the end of the world for that game but still a bug.


Picklesworth(Posted 2006) [#4]
If you feel like subjecting yourself to immense pain, This DLL may be able to do what you want with a few custom tweaks.
I believe that there is a way, using CreateProcess or ShellExecute_ex (Windows API things) to specify where a program's window is positioned (behind yours), start it minimized, or even start it with a hidden window.
This won't work for all programs, but I know that the technique can give us full control over the placement and window title of programs like the Command Prompt or Notepad.


Worth a try, anyway :)
Source should be included in the Zip.


HappyCat(Posted 2006) [#5]
It's a shame that a language that's ideal for writing shareware games doesn't have a polished way of supporting "buy now" type web links :-)

Never mind, I'll keep trying and see what I can some up with.


jfk EO-11110(Posted 2006) [#6]
When you call ExecFile in Fullscreenmode, the Blitz App will be paused until it will regain focus, eg. by a mouseclick.

The "always on top" setting is indeed confusing, must be a pretty new "feature". I think you can set its z-depth using the win api call "SetWindowPos" (or similar).

The easiest solution may be to :
-switch to windowed mode
-minimize window
-run browser

As long as AppTitle is used, the user won't have too much troubles to get back to the game.

Tho, the thing that is most disturbing is the fact that you need to reload all 3D Data etc. if you change the Graphics Mode.


Picklesworth(Posted 2006) [#7]
Here is a quick example of how to set Always On Top for a window with the winAPI (needs User32.decls):
Const HWND_TOPMOST = -1 
Const HWND_NOTOPMOST = -2 
Const SWP_NOSIZE = 1 
Const SWP_NOMOVE = 2 
Const SWP_SHOWWINDOW = 40 
Const SW_RESTORE=9

Graphics 640,480,0,2
AppTitle("This Window is always on top!")
myhWnd=SystemProperty("apphwnd")

api_SetWindowPos( myhWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE )
WaitKey
End


With that function (check MSDN or API-Guide from AllAPINetwork for a reference), you can specify what z position you want for the window and apply other tags similar to HWND_TOPMOST.


HappyCat(Posted 2006) [#8]
When you call ExecFile in Fullscreenmode, the Blitz App will be paused until it will regain focus, eg. by a mouseclick.

That'd be great, but on the three PCs I've tried it on, on returning to the Blitz app it's frozen and never comes back.

The easiest solution may be to :
-switch to windowed mode
-minimize window
-run browser

I tried that on a couple of my less tech-savvy friends. Two downsides were:

- They both though the game had closed down (when it was actually minimised) and tried running it again to get back to it (actually, maybe shutting down the game and launching the URL might work okay ... hmm ...)

- It's seems "rude" to switch to a screen mode that isn't the one the player has chosen.


Pinete(Posted 2006) [#9]
sorry, I have a related question..
Does Blitz allows to check if ALT+TAB has been pressed?
if no, what's the way to do that?

thanks and sorry for the "interruption" :)

regards,


BlackJumper(Posted 2006) [#10]
@Pinete: You could try my StickyKeys blocking dll...

http://www.blitzbasic.com/Community/posts.php?topic=49698

Hope this helps :-)


jfk EO-11110(Posted 2006) [#11]
Switching to windowed mode for some critical stuff isn't bad IMHO. Things like firewall alerts etc. may work properly only when the blitz App runs in windowed mode. (See the tutorial thread about how to prevent hidden OS alerts etc.)

If your friend misssed the minimised window then it was his mistake, really. However, it's the programmers job to prevent the users mistake.

SetWindowPos should work well on all Windows machines, make sure all parameters are set correctly! Read the description of the Api call, on msdn.com or download a win Api help file , eg. from here:
http://flatassembler.net/docs.php
(scroll down to the bottom)


HappyCat(Posted 2006) [#12]
Okay, I finally settled on the following (if launching the URL in fullscreen mode):

- Switch to windowed mode, but remember that it was in fullscreen mode before.
- Make the Blitz window non-topmost (using SetWindowPos with HWND_NOTOPMOST - thanks Mr. Picklesworth).
- Restore the display mode setting to fullscreen at shutdown (unless the player has changed it manually before then).

I'm quite happy with that now. Thanks for all the help :-)


Litobyte(Posted 2009) [#13]
many AAA games ( such as LFS, Live for Speed) which change to windowed when the user is asked for internet / LAN / firewall settings.

not bad at all, better than having the fullscreenwindow minimized when windows firewall popup cames out.

I have similar problem, I'd like to be able to call another exe before my starting exe ends.

If you have to launch 10 times the same exe and when it ends it starts another one, well, this is impossibile with blitz commands..

I'm searching a .bat script solution...let's se..


jfk EO-11110(Posted 2009) [#14]
Hi Tommaso, good to see you.

BTW an other way to launch an external App may be to

-switch from fullscreen to windowed mode
-use api command to hide the window
-run the external app, eg. open a browser to register the shareware

While the window is hidden, it is not paused or forzen and it also can't be "topmost" or focused - for obvious reasons.