Thread: Force a game to top

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218

    Force a game to top

    I am running a dual-monitor setup, and my thought is to have a game running on the main monitor and then a webbrowser or something like that on the other monitor. Problem is that when i go to the browser to do something the game minimizes, so i wondered if there is any way to force an application to run on top. Note that the game is running fullscreen.

    Even if i must write my own launcher for the game i am ready to do so.

    Edit: running the game in windowed mode is not an option since the fps drops too much.
    Last edited by Shakti; 07-05-2006 at 09:53 AM.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Many games automatically minimize when they lose focus. This is because otherwise they'd block the screen they are on, without any way of getting rid of it. I consider that a good thing.

    You can probably forcefully maximize it again, but as Raymond Chen says, getting applications into a situation they don't expect is a good way to crash them. In your case, the application, on receiving a killfocus notification, mimizes, probably pauses and perhaps even discards the graphics context. Then you maximize it again - what do you think will happen. (Answer: no idea. It's most definitely undefined behaviour.) On receiving focus, the application will maximize, recreate the GC and unpause. This is the method it should be reactivated, and no other.

    You're actually quite lucky that the game doesn't crash simply from losing focus. I know far too many games that do that or something similar. (Myst 3, for example, fails to reacquire the mouse, rendering it inactive.)

    As I said, you can experiment. Try installing a system-wide hook watching for the window being minimized and immediately maximize it again. Just don't expect it to work.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Ok, Ill see what i do then but thnx for the input.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  2. PC Game project requires c++ programmers
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 02-22-2006, 12:23 AM
  3. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  4. Engine <=> DX/OGL | c++ ?
    By darkcloud in forum Game Programming
    Replies: 6
    Last Post: 05-13-2005, 12:19 AM
  5. Stack functions as arrays instead of node pointers
    By sballew in forum C Programming
    Replies: 8
    Last Post: 12-04-2001, 11:13 AM