Partager via


WM_PAINT (Windows CE 5.0)

Send Feedback

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 UpdateWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.

WM_PAINT hdc = (HDC)wParam;

Parameters

  • hdc
    Handle to the device context to draw in.

    If this parameter is NULL, use the default device context.

    This parameter is used by some common controls to enable drawing in a device context other than the default device context.

    Other windows can safely ignore this parameter.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function 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.

DispatchMessage determines where to send the message.

GetMessage determines which message to dispatch.

GetMessage returns the WM_PAINT message when there are no other messages in the application's message queue.

DispatchMessage sends the message to the appropriate window procedure.

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 a non-NULL update.

The system sends an internal WM_PAINT message only once. After an internal WM_PAINT message is returned from GetMessage or PeekMessage or is sent to a window by UpdateWindow, the system does not post or send further WM_PAINT messages until the window is invalidated.

For some common controls, the default WM_PAINT message processing checks the wParam parameter.

If wParam is non-NULL, the control assumes that the value is an HDC and paints using that device context.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.

See Also

BeginPaint | DefWindowProc | DispatchMessage | EndPaint | GetMessage | GetUpdateRect | PeekMessage | UpdateWindow | WM_ERASEBKGND

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.