Thread: window remains active

  1. #1
    Registered User
    Join Date
    Aug 2001

    window remains active

    I'm game runs in a window and remains active when it's not in the foreground. For example let say I have notepad on top of my game. My game will still proceed as normal. How do I make it pause. From searching this probabley has to do with using PeekMessage instead of GetMessage, correct? GetMessage sleeps when there are not messages ,while PeekMessage is awake even when there aren't any messages.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Registered User
    Join Date
    Nov 2001
    Interesting. See if you can change the killfocus message.


  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Get yourself a global BOOL variable and set it to TRUE (Global is the simplest way unless you have another option). In your message loop, set an if that only checks for messages and processes game logic when the variable is TRUE.

    Then create a handler for WM_SETFOCUS & WM_KILLFOCUS and set the variable as false when you lose focus and true when you have it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM