CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: WM_SIZE

  1. #1
    Join Date
    Mar 1999
    Posts
    37

    WM_SIZE

    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


  2. #2
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: WM_SIZE

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured