Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This message is sent by an application when Windows or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindowfunction is called, or by the DispatchMessagefunction when the application obtains a WM_PAINT message by using the GetMessageor PeekMessagefunction.
WM_PAINT hdc= (HDC) wParam;
Parameters
Return Values
An application should return zero if it processes this message.
Remarks
The DefWindowProcfunction validates the update region. The function may send the WM_ERASEBKGND message if the window background must be erased.
The system sends this message when there are no other messages in the application's message queue. DispatchMessagedetermines where to send the message; GetMessagedetermines which message to dispatch. GetMessagereturns the WM_PAINT message when there are no other messages in the application's message queue, and DispatchMessagesends the message to the appropriate window procedure.
A window may receive internal paint messages as a result of calling RedrawWindowwith the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRectfunction to determine whether the window has an update region. If GetUpdateRectreturns zero, the application should not call the BeginPaintand EndPaintfunctions.
An application must check for any necessary internal painting by looking at its internal data structures for each WM_PAINT message, because a WM_PAINT message may have been caused by both a non-NULL update region and a call to RedrawWindowwith the RDW_INTERNALPAINT flag set.
The system sends an internal WM_PAINT message only once. After an internal WM_PAINT message is returned from GetMessageor PeekMessageor is sent to a window by UpdateWindow, the system does not post or send further WM_PAINT messages until the window is invalidated or until RedrawWindowis called again with the RDW_INTERNALPAINT flag set.
For some common controls, the default WM_PAINT message processing checks the wParamparameter. If wParamis non-NULL, the control assumes that the value is an HDC and paints using that device context.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
BeginPaint, DefWindowProc, DispatchMessage, EndPaint, GetMessage, GetUpdateRect, PeekMessage, UpdateWindow, WM_ERASEBKGND