WM_ERASEBKGND

This message is sent when the window background needs erasing (for example, when a window is resized). It is sent to prepare an invalidated region for painting.

Parameter Description  

wParam Contains the device-context handle.  
lParam Is not used.  

Return Value

The return value is nonzero if the background is erased. Otherwise, it is zero. If the application processes the WM_ERASEBKGND message, it should return the appropriate value.

Default Action

The background is erased, using the class background brush specified by the hbrbackground field in the class structure.

Comments

If hbrbackground 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 assumes the background should be computed 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.