I tested ShowWindow in several ways - a main program window, child windows, dialog boxes. I set breakpoints to follow the step-by-step results of ShowWindow (WM_ERASEBKGND, WM_PAINT, WM_SHOWWINDOW...).
Vista is working O.K. in my tests.
I don't know what language you are using to program. My tests were with plain "C" code.
Maybe something to help: (?) If this doesn't help, please tell us more about what language you are programming with, and what type of window is displaying the flash of black.
1) If you register your own class for this window, Check the "hbrBackground" setting that you register. If you want a normal background color, it should be "COLOR_WINDOW + 1".
2) If you handle the WM_ERASEBKGND message for the window, be sure your brush is initialized properly and you are returning a non-zero value.
Thanks for your help.
I using Microsoft Vistual C++ 6.0 with windows SDK.
I want to create a window and show a picture on the window on WM_PAINT.
The hbrBackground of window class is NULL.
I create the window, then show it by calling ShowWindow. You can set the breakpoint on ShowWindow. After ShowWindow called, Immedialitly on the desktop a window is shown with black background. It is defferent with Windows XP and 2000. Under Windows XP and before, window client region will not be paint with black background.
When hbrBackground is set to NULL, you are supposed to process the erasing of the background. MSDN documentation indicates:
"If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background. "
If your picture covers the entire window client area, you could process the WM_ERASEBKGND message and show your picture? The wParam field provides the DC to paint to. Show the picture and then return a non-zero value to indicate you handled the background painting.
Does this help?