Re: Get MDI client area?
Where are you calling the dialog box from? Is you event handler to bring up
the dialog box in the CMainFrame?
If so I would simply get the rectangle before you call DoModal and pass it
to the dialog.
If for some reason you don't want to do that, then you can do this:
void CMDIArrangeDlg::GetMDIClientRect()
{
int nCaptionHeight=GetSystemMetrics(SM_CYCAPTION),
nEdgeThickness=GetSystemMetrics(SM_CYSIZEFRAME),
nMenuHeight=GetSystemMetrics(SM_CYMENU);
// Get the MDI client area
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
::GetClientRect(pFrame->m_hWndMDIClient,&m_rectPos);
// Subtract height of title bar and width of edge * 2
m_rectPos.bottom-=((nEdgeThickness*4)+nCaptionHeight+nMenuHeight);
m_rectPos.right-=((nEdgeThickness*4));
}
But I highly encourage you to put your handler for the dialogbox in the
frame class, and pass the rect into the constructor of the dialog.
AliR.
"Peter Boulton" <peter@data*nospam*perceptions.co.uk> wrote in message
news:mn.a3b67d950fb90849.89290@datanospamperceptions.co.uk...
Thanks! But how do I get a pointer to the MDI frame?
Pete
AliR (VC++ MVP) formulated the question :
The MDI frame has a member m_hWndMDIClient. Try getting the rect of that
window.
AliR.
"Peter Boulton" <peter@data*nospam*perceptions.co.uk> wrote in message
news:mn.a39d7d95a28e89d1.89290@datanospamperceptions.co.uk...
I'm trying to get the client workspace area in a CRect for an MDI
appplication - that's the background rectangle in which all the MDI
windows float and tile.