WM_PAINT

2.x

WM_PAINT

The WM_PAINT message is sent when Windows or an application makes a request to repaint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.

Parameters

This message has no parameters.

Return Value

An application should return zero if it processes this message.

Comments

The DispatchMessage function sends this message when there are no other messages in the application's message queue.

A window may receive internal paint messages as a result of calling the RedrawWindow function with the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRect function to determine whether the window has an update region. If GetUpdateRect returns zero, the application should not call the BeginPaint and EndPaint functions.

It is an application's responsibility to check for any necessary internal repainting or updating by looking at its internal data structures for each WM_PAINT message, because a WM_PAINT message may have been caused by both an invalid area and a call to the RedrawWindow function with the RDW_INTERNALPAINT flag set.

An internal WM_PAINT message is sent only once by Windows. After an internal WM_PAINT message is returned from the GetMessage or PeekMessage function or is sent to a window by the UpdateWindow function, no further WM_PAINT messages will be sent or posted until the window is invalidated or until the RedrawWindow function is called again with the RDW_INTERNALPAINT flag set.

See Also

BeginPaint, DispatchMessage, EndPaint, GetMessage, PeekMessage, RedrawWindow, UpdateWindow