WM_ERASEBKGND
hdc = (HDC) wParam; /* device-context handle */
The WM_ERASEBKGND message is sent when the window background needs to be erased (for example, when a window is resized). It is sent to prepare an invalidated region for painting.
hdc
Value of wParam. Identifies the device context.
An application should return nonzero if it erases the background; otherwise, it should return zero.
The DefWindowProc function erases the background by using the class background brush specified by the hbrbackground member of the WNDCLASS structure.
If the hbrbackground member is NULL, the application should process the WM_ERASEBKGND message and erase the background color. When processing the WM_ERASEBKGND message, the application must align the origin of the intended brush with the window coordinates by first calling the UnrealizeObject function for the brush and then selecting the brush.
Windows computes the background by using the MM_TEXT mapping mode. If the device context is using any other mapping mode, the area erased may not be within the visible part of the client area.