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


Updated: October 2008

Calculates the window rectangle that can contain the specified client rectangle.

virtual void CalcWindowRect(
   LPRECT lpClientRect,
   UINT nAdjustType = adjustBorder 

[in, out] lpClientRect

Pointer to a rectangle structure. On input, this structure contains the client rectangle. After the method is finished, this structure contains the window rectangle that can contain the specified client rectangle.

[in] nAdjustType

Use CWnd::adjustBorder to calculate window coordinates without the WS_EX_CLIENTEDGE style; otherwise, use CWnd::adjustOutside.

The size of the calculated window rectangle does not include space for a menu bar.

For more usage restrictions, see AdjustWindowRectEx.

// Uses CalcWindowRect to determine size for new CFrameWnd 
// based on the size of the current view. The end result is a 
// top level frame window of the same size as CMdiView's frame. 
void CMdiView::OnMyCreateFrame() 
   CFrameWnd* pFrameWnd = new CFrameWnd;
   CRect myRect;
   pFrameWnd->Create(NULL, _T("My Frame"));
   pFrameWnd->CalcWindowRect(&myRect, CWnd::adjustBorder);
   pFrameWnd->MoveWindow(0, 0, myRect.Width(), myRect.Height());

Header: afxwin.h




October 2008

Updated whole topic.

Customer feedback.

© 2015 Microsoft