WM_NCPAINT

An application sends the WM_NCPAINT message to a window when its frame must be painted.

WM_NCPAINT 
hrgn = (HRGN) wParam;   // handle of update region 
 

Parameters

hrgn
Value of wParam. Handle to the update region of the window. The update region is clipped to the window frame. When wParam is 1, the entire window frame needs to be updated.

This 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);
}
 

Return Values

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.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.

See Also

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