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
An application should return zero if it processes this message.
The DefWindowProc function paints the window frame.
An application can intercept this 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.