CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    64

    Retrieving Dimension of a NonClientArea in a MDI Application

    Hi,
    I am having an MDI Application.
    My problem is that I want to retrieve the dimensions of NonClientArea of the frame Window.

    Can u suggetst , which API can be used for this purpose.

    With Best Regs

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Retrieving Dimension of a NonClientArea in a MDI Application

    Interesting.

    Here is the code:
    Code:
       CWnd* pWndMDIClient = CWnd::FromHandle(m_hWndMDIClient);
       CRect rcFrame, rcMDIClient;
       GetWindowRect(rcFrame);
       pWndMDIClient->GetWindowRect(rcMDIClient);
    
       const int nTopHeight    = rcMDIClient.top - rcFrame.top;
       const int nBottomHeight = rcFrame.bottom - rcMDIClient.bottom;
       const int nLeftWidth    = rcMDIClient.left - rcFrame.left;
       const int nRightWidth   = rcFrame.right - rcMDIClient.bottom;
    Note that m_hWndMDIClient is a public member of CMDIFrameWnd and represents the handle of MDI Client window.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Jun 2005
    Location
    Tirunelveli-Tamil Nadu-India
    Posts
    354

    Smile Re: Retrieving Dimension of a NonClientArea in a MDI Application

    If I Helped You, "Rate This Post"

    Thanks
    Guna

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Retrieving Dimension of a NonClientArea in a MDI Application

    Quote Originally Posted by Gunaamirthavelu
    I have tried it.
    BTW. What's the connection between OP and "Control Subclassing"?
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Retrieving Dimension of a NonClientArea in a MDI Application

    Quote Originally Posted by ovidiucucu
    Note that m_hWndMDIClient is a public member of CMDIFrameWnd and represents the handle of MDI Client window.
    I don't think that MDI Client Window has non-client area... But the same code will do just fine for the Frame.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  6. #6
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Retrieving Dimension of a NonClientArea in a MDI Application

    Quote Originally Posted by VladimirF
    I don't think that MDI Client Window has non-client area...
    I dind't say that.
    The OP was referring to "nonclient area of the frame window in an MDI application".

    At a first look I was tempted to answer: "1. call GetWindowRect to get the frame window rectangle; 2. call GetClientRect to get the frame client rectangle; 3. call CientToScreen to transform client rectangle in screen coordinates. 4. make the difference between the two rectangle coordinates...".

    But after that, I realised (hope was not wrong, since the question was quite vague) that OP wants in fact the dimensions of main frame window that include docked control bars and status bar.
    In that case, you can make the difference between frame window rectangle and contained MDI client window rectangle, as shown in my example.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  7. #7
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Retrieving Dimension of a NonClientArea in a MDI Application

    Quote Originally Posted by ovidiucucu
    I dind't say that.
    The OP was referring to "nonclient area of the frame window in an MDI application"...
    Sorry, I misread your code...
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

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