Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WM_NCPAINT message

The WM_NCPAINT message is sent to a window when its frame must be painted.

A window receives this message through its WindowProc function.


LRESULT CALLBACK WindowProc(
  HWND hwnd, 
  UINT  uMsg, 
  WPARAM wParam, 
  LPARAM lParam     
);

Parameters

wParam

A handle to the update region of the window. The update region is clipped to the window frame.

lParam

This parameter is not used.

Return value

An application returns zero if it processes this message.

Remarks

The DefWindowProc function paints the window frame.

An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

The wParam value can be passed to GetDCEx as in the following example.



case WM_NCPAINT:
{
    HDC hdc;
    hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
    // Paint into this DC 
    ReleaseDC(hwnd, hdc);
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

See also

Painting and Drawing Overview
Painting and Drawing Messages
DefWindowProc
GetWindowDC
WM_PAINT
GetDCEx

 

 

Community Additions

Show:
© 2014 Microsoft