Platform SDK: Windows User Interface
WM_ERASEBKGND
The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_ERASEBKGND
WPARAM wParam, // handle to device context (HDC)
LPARAM lParam // not used
);
Parameters
wParam
Handle to the device context.
lParam
This parameter is not used.
Return Values
An application should return nonzero if it erases the background; otherwise, it should return zero.
Remarks
The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.
An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)
Platform SDK: Windows User Interface
WM_ERASEBKGND
The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_ERASEBKGND
WPARAM wParam, // handle to device context (HDC)
LPARAM lParam // not used
);
Parameters
wParam
Handle to the device context.
lParam
This parameter is not used.
Return Values
An application should return nonzero if it erases the background; otherwise, it should return zero.
Remarks
The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.
An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)
LRESULT CSdfadfDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (message == WM_ERASEBKGND )
{
TRACE("WM_ERASEBKGND.\n");