Click to See Complete Forum and Search --> : Resizing Mdi Child Window


tguha
September 5th, 1999, 09:36 AM
Hi there,

I want to make the Mdi child length same as the mainframe available length in the client area.

How can I find out what is the length of the available client area of mainframe.

How can I change the length of the mdi child with the same length.

Also when I change some x or y coordinated of the cs structure of mdi child window in Precreatewnd function I don't see any child window at all.Even though the title bar shows that the document object is being created.Can anybody throw some light on this problem.

Thanx in advance.

ric980
September 6th, 1999, 02:06 AM
CRect rect;
CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
pMain->GetClientRect(&rect);
CChildFrame* pChild = (CChildFrame*)MDIGetActive();
pChild->MoveWindow(rect);

tguha
September 6th, 1999, 01:13 PM
Hi there,

Your piece of code is great. It works very well.I do have some more question, if you could help me.

1. How can I calculate exact size of free client area in Mdi Main Frame window.I mean Mdi Main Frame has Menu Bar, Tool Bar and Status Bar.How can I calculate the available client area excluding those windows.

2. Your piece of code I have sticked into Mainframe onsize function.Is it the right place to do it ?

3. When I have more than one Mdi child activated how I can get hold of each of them and resize all of them.

Thanx very much for your help.

Tapas
tguha@hotmail.com

Gregory64
September 10th, 1999, 11:13 AM
Hi ric,
Have you ever heard that client area in MDI application is reprezented by MDIClient not by CMainFrame. This object has no class in MFC but you can Subclass it. CMainFrame has handle to it.
However I'm not gona send you in Zimbabve.
(Mejdu drugoto priznavam che s trieneto na kontrol be mnogo glupavo,kakvo da pravis sluchvat se zatamnenia)
:-)

ric980
September 14th, 1999, 04:02 AM
Oh, man, you want to send ME to Zimbabve. You will subclass the MDIClient just to take its size. Oh, boy, ti neshto pak si v zatumnenie. Znaesh kvo niakoi den ako ti doide prosvetlenie pak se obadi da podiskutirame tui onui. A mejdu drugoto vij choveka kakvo e kazal za moia kod. Vsichko kazano dotuk e napulno v priatelski ton, taka che do not be insulted in some way, vsichko e na maitap i da se porazseiat the boring discussions over here.