Returning from fullscreen mode, redraw desktop

This is a discussion on Returning from fullscreen mode, redraw desktop within the Windows Programming forums, part of the Platform Specific Boards category; How can I cause a complete redraw of all windows, nested windows and client areas ? I need this for ...

  1. #1
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314

    Returning from fullscreen mode, redraw desktop

    How can I cause a complete redraw of all windows, nested windows and client areas ?

    I need this for an application that runs in fullscreen and windowed mode. When it returns from fullscreen to windowed mode, only some of the others applications windows are redrawn and none of their client areas.

    I've searched the board and found these functions:

    InvalidateRect(HWND_BROADCAST, NULL, FALSE);
    UpdateWindow(HWND_BROADCAST);

    SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);


    The first method (invalidate and update) only redraws the titlebars for some reason, the other method redraws a few elements like a windows' menu and quickbars, but it's extremely slow and doesn't redraw all of the window (the renderer-area in a browser or the editor component of DEV C++ etc). I could probably speed this up by posting the message instead of sending it, but right now, not even sending it works properly.

    Is there anyone who can give me a little hint (or two) ?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    7
    I think RedrawWindow() may be the answer, I generally use the following for redrawing a window entirely:

    RedrawWindow([handle],NULL,NULL,RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN);
    UpdateWindow([handle]);

    or

    RedrawWindow([handle],NULL,NULL,RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN | RDW_UPDATENOW);

    I've no idea how it would perform on an entire desktop of windows however. RedrawWindow won't return until all windows have been redrawn if RDW_UPDATENOW is used, and i presume the same with the use of UpdateWindow.

    Both do the same thing anyway, just a matter of preference i suppose. (Although the second feels mroe natural in my opinion)

    (Actually I did once use this with EnumWindows to redraw everything when returning from full screen opengl. It was resonably quick, although there was noticable lag in the redrawing. )
    Last edited by Tada; 08-23-2003 at 05:28 PM.

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Try ChangeDisplaySettings as follows:
    Code:
    ChangeDisplaySettings(0,0);
    which causes a WM_DISPLAYCHANGE to be sent to all top level windows.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Have you tried PostMessage instead? I have run into a few instances where PostMessage works when SendMessage doesn't and vica versa. Other then that I have no idea

  5. #5
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    Thanks everybody!

    I tried Postmessage, Thantos, but that didn't work at all. Same goes for RedrawWindow, Tada.

    ChangeDisplaySettings seems to work however. Which is very strange since thats exactly the command I also use to return to the desktop (even with the same parameters). So basically what I do now is calling it twice when leaving fullscreen. Once before I restore my windows shape and once after it but before showing the reshaped window again.
    It works perfectly... but isn't that a bit strange ?

    Anyways, thanks again! It works and seems to be pretty fast, too. I cannot say that I want more than that

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, 10:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  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, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21