windows_programming_notes.nbk: Home | Index | Next Page: WM_NCRBUTTONDBLCLK | Previous Page: WM_NCMOUSEMOVE


 WM_NCPAINT

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,       // handle to window
      UINT uMsg,       // WM_NCPAINT
      WPARAM wParam,   // handle to update region (HRGN)
      LPARAM lParam    // not used
    );

Parameters

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.

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

  Windows NT/2000 or later: Requires Windows NT 3.1 or later.
  Windows 95/98/Me: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

windows_programming_notes.nbk: Home | Index | Next Page: WM_NCRBUTTONDBLCLK | Previous Page: WM_NCMOUSEMOVE


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time