Alex
September 9th, 1999, 11:37 AM
Hi every one,
I have a MDI interface with few different View,
I've handled message WM_SIZE in CMianFrame class and I wont send this message to every View I have.
What is the easiest way to do that?
Thank you
Oleg Lobach
September 10th, 1999, 03:02 AM
Hello Alex,
Try this:
CMDIApp* pApp=(CMDIApp* )AfxGetApp();
WPARAM fwSizeType;
LPARAM nNewSize;
nNewSize=MAKELONG(nWidth,nHeight);
fwSizeType=SIZE_RESTORED;//For instance
POSITION posTempl=pApp->GetFirstDocTemplatePosition();
while (posTempl)
{
CDocTemplate* pTemplate=pApp->GetNextDocTemplate(posTempl);
POSITION posDoc=pTemplate->GetFirstDocPosition();
while(posDoc)
{
CDocument* pDocument=pTemplate->GetNextDoc(posDoc);
POSITION posView=pDocument->GetFirstViewPosition();
while(posView)
{
CView* pView=pDocument->GetNextView(posView);
if(! pView->IsIconic()) // comment this line if you wish to consider minimized views.
pView->SendMessage(WM_SIZE,fwSizeType,nNewSize);
}
}
}
For more short way consider using CWnd::SendMessageToDescendants(...), but it'll send the message to all childs, including MDIClient and CMDIChildWnd derived.
Let me know if it answers the question.
Good luck,
Oleg.