Thread: restoring desktop after full screen use

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    596

    restoring desktop after full screen use

    I am using win32 applications for some full screen graphics. How do I restore
    the desktop, windows, taskbar, etc when exiting the app?

    Do I need to create a bitbap and bitblt the desktop screen into it, and then
    bitblt it back afterward? Or is there a way to instruct the system to just
    redraw everything?

    I am retrieving a device context for my screen with GetDC(NULL).

    *** edited ***

    I just realized I could open a full screen window, then draw over it with using
    a full screen context. Closing the full screen window should then invoke a desktop
    redraw. But the window would not cover the taskbar. So that's still a problem.
    (haven't tried this last thing yet)
    Last edited by megafiddle; 04-05-2011 at 10:56 PM.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You should be able to call Invalidate() and pass in the handle to the desktop window.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    I am using win32 applications for some full screen graphics. How do I restore
    the desktop, windows, taskbar, etc when exiting the app?

    Do I need to create a bitbap and bitblt the desktop screen into it, and then
    bitblt it back afterward? Or is there a way to instruct the system to just
    redraw everything?

    I am retrieving a device context for my screen with GetDC(NULL).

    *** edited ***

    I just realized I could open a full screen window, then draw over it with using
    a full screen context. Closing the full screen window should then invoke a desktop
    redraw. But the window would not cover the taskbar. So that's still a problem.
    (haven't tried this last thing yet)
    Do your full screen app in a window... closing the window restores the desktop.

    NEVER draw directly on the desktop itself.

    http://blogs.msdn.com/b/oldnewthing/...2/9994016.aspx
    Last edited by CommonTater; 04-06-2011 at 10:12 PM.

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Thanks

    Quote Originally Posted by VirtualAce View Post
    You should be able to call Invalidate() and pass in the handle to the desktop window.
    Is that InvalidateRect()? It is not recommended for redrawing all windows ( InvalidateRect(NULL, ....) )
    Do you know what the problems might be with that?

    Also, still problem with task bar. I can't draw a full screen window over it.

    Quote Originally Posted by CommonTater View Post
    Do your full screen app in a window... closing the window restores the desktop.

    NEVER draw directly on the desktop itself.

    How do I switch a window between normal and fullscreen? - The Old New Thing - Site Home - MSDN Blogs
    I was initially trying to use a simple thin border frame with no title bar. WS_DLGFRAME as a
    style is supposed to do this but doesn't work. Apparently a known bug or documentation
    error.

    I don't completely understand the code in the link. Does it change the style so that it has
    no title bar? Wouldn't that not work either if the window can't be created without a title bar
    to begin with?

    Or does it just reposition the window so the title bar is off screen?

    Also what is a full screen DC used for typically? What kinds of problems will it cause?
    Last edited by megafiddle; 04-07-2011 at 10:19 PM.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Try just using WS_POPUP (and WS_VISIBLE).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Quote Originally Posted by novacain View Post
    Try just using WS_POPUP (and WS_VISIBLE).
    Ok, thanks

    That seems to work. Noticed something strange though.
    If the window width is set equal to the screen width, it covers the task bar. But if
    the width is just one pixel less, it doesn't cover the task bar. That's 1679 vs 1680
    with my monitor.

    WS_OVERLAPPEDWINDOW never seems to cover the task bar, regardles of the
    width.

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Ok, thanks

    That seems to work. Noticed something strange though.
    If the window width is set equal to the screen width, it covers the task bar. But if
    the width is just one pixel less, it doesn't cover the task bar. That's 1679 vs 1680
    with my monitor.

    WS_OVERLAPPEDWINDOW never seems to cover the task bar, regardles of the
    width.
    Much of this behavior depends on whether or not the user has set the taskbar or toolbars to always be on top. That being said WS_POPUP windows should be able to cover the entire screen (at least they could in XP).

  8. #8
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Quote Originally Posted by VirtualAce View Post
    Much of this behavior depends on whether or not the user has set the taskbar or toolbars to always be on top. That being said WS_POPUP windows should be able to cover the entire screen (at least they could in XP).
    I just tested WS_POPUP and WS_OVERLAPPEDWINDOW with a hidden task bar (XP, 1680 x 1050 display).
    Both behave just as you might expect, and can cover the entire screen.

    But only WS_POPUP will cover an exposed task bar, and only if set equal to or greater than the full screen width. I'll check it on 2000 Pro.

    Anyway it apperantly works, but would be nice to know if it's a defined behavier.
    Last edited by megafiddle; 04-09-2011 at 09:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 03-02-2011, 07:35 PM
  2. Opening in full screen
    By MaGaIn in forum C++ Programming
    Replies: 14
    Last Post: 08-21-2007, 11:12 AM
  3. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  4. Full screen programs?
    By Welshy in forum C++ Programming
    Replies: 10
    Last Post: 04-23-2005, 10:18 AM
  5. Full Screen
    By Rainer in forum C++ Programming
    Replies: 4
    Last Post: 08-08-2003, 05:56 AM