The white flash

If you had a program that didn't process messages for a while, but it needed to be painted for whatever reason (say, somebody uncovered it), Windows would eventually lose patience with you and paint your window white.

Or at least, that's what people would claim. Actually, Windows is painting your window with your class background brush. Since most people use COLOR_WINDOW and since COLOR_WINDOW is white in most color schemes, the end result is a flash of white.

Why paint the window white? Why not just leave it alone?

Well, that's what it used to do, but the result was that the previous contents of the screen would be shown where the window "would be". So suppose you were looking at Explorer, and then you restored a program that stopped responding. Inside the program's main window would be... a picture of Explorer. And then people would try to double-click on what they thought was Explorer but was really a hung program.

In Windows XP, the behavior for a window that has stopped painting is different. Now, the system captures the pixels of the unresponsive window and just redraws those pixels if the window is unable to draw anything itself. Note, however, that if the system can't capture all of the pixels - say because the window was partially covered - then the parts that it couldn't get are filled in with the class brush.

Which is usually white.

Comments (12)
  1. Mike Dunn says:

    How about the menu bar? I have VC 6 set to use a real menu (not the "toolbar that looks like a menu" style) and when it hangs* the menu bar turns white. Why is that part of the window bits not saved?

    *Not that the IDE hangs, but it blocks for a long time occasionally because it’s waiting on VSS to do its thing.

  2. Raymond Chen says:

    I suspect the hung app code only saves the client area. I don’t actually know much about how the hung app code works; it’s not my area.

  3. Alex Feinman says:

    I wonder – what does Mac do?

  4. Dan Maas says:

    Mac OSX does what Windows XP does. Since all windows are double-buffered in OSX, the entire window contents are always visible as they were last painted. To indicate the app is not responding to events, OSX changes the cursor to the infamous "spinning beachball of death."

    Pre-OSX, Macs used cooperative multitasking. So if an app hangs, your whole system is hosed.

  5. Ian Hanschen says:


    This feature is called window ghosting. Basically what happens is if the window manager decides the window is hung, it will capture the contents of it’s client area, and create a window on the screen with the class ‘ghost’, with the contents it was able to capture, and the window styles of the original window(in most cases, iirc). So the window you see on screen when the app is not responding is not actually the app’s window, just a replacement that will hang around until the thread responsible for that window starts responding again. The menubar is gone because the fake window does not have a menu, just extra space for it which is painted white. A disabled menubar would probably cause support problems.

    This functionality can be disabled using the call DisableProcessWindowsGhosting(), but it’s not recommended.

  6. Edward says:

    I’m assuming that under Longhorn and the DCE this will no longer occur, since the entire contents of the window will have been buffered regardless of if it was covered up or not.

    You’ll have to come up with some other notification that an app has hung, perhaps render it with the colours reversed?

  7. Ian Hanschen says:

    Could always display it weighted 50% against black.

  8. asdf says:

    NULL and custom non-solid brush apps turn white too (at least on win2k). I’d suspect most apps turn white because they use a NULL_BRUSH so their program doesn’t flicker from WM_ERASEBKGND because they’re double buffering or they haven’t taken windows programming 101 yet.

  9. keithmo says:

    Ah yes…reminds me of the old "Exchange Wallpaper" effect.

  10. CW User says:

    Any recommendations how to create Mac OS X effect Expose for

    my Windows app?

    Should I go with MetaFiles or BitMaps? And when to capture


    Did anyone try to implement WindowShade in his app on Windows?

    I am not trying to create OS skins or any kind of extension to OS, but

    would like to have these things as an option only within my


  11. matus says:

    >>You’ll have to come up with some other

    >>notification that an app has hung, perhaps

    >>render it with the colours reversed?

    >Could always display it weighted 50% against black.

    Or perhaps 50% against blue… resembling the BSOD ;).

  12. Raymond Chen says:

    Commenting for this article has been closed.

Comments are closed.

Skip to main content