I want to change the appearance of a window's caption bar, so I decided to override the OnNcPaint() method of CMainFrame. But when I did this, I found a problem. If there is another window covering my window, and I drag the window quickly, the content of the client area of my window disappeared, which came to sight only when I stopped the dragging.
My overridden OnNcPaint() is like below:
void CMainFrame::OnNcPaint()
{
    CDC* pWinDC = GetWindowDC();
    //do some drawing
    ReleaseDC(pWinDC);
}
Is there something wrong with my approach? Thank you!