Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Updates the client area by sending a WM_PAINT message if the update region is not empty.

void UpdateWindow( );


The UpdateWindow member function sends a WM_PAINT message directly, bypassing the application queue. If the update region is empty, WM_PAINT is not sent.


// In this example a rectangle is drawn in a view. 
// The OnChangeRect() function changes the dimensions 
// of the rectangle and then calls CWnd::Invalidate() so the 
// client area of the view will be redrawn next time the
// window is updated.  It then calls CWnd::UpdateWindow 
// to force the new rectangle to be painted.

void CTestView::OnChangeRect() 
   // Change Rectangle size.
   m_rcBox = CRect(20, 20, 210, 210);

   // Invalidate window so entire client area 
   // is redrawn when UpdateWindow is called.

   // Update Window to cause View to redraw.

// On Draw function draws the rectangle.
void CTestView::OnDraw(CDC* pDC)
//  ..  Other draw code here.

   pDC->Draw3dRect(m_rcBox, 0x00FF0000, 0x0000FF00);

See Also

CWnd Overview | Class Members | Hierarchy Chart | UpdateWindow | CWnd::RedrawWindow

© 2015 Microsoft