Solved

Toolbar and Statusbar in a MDI environment?

Posted on 1998-09-01
3
872 Views
Last Modified: 2013-12-03
I'm writing a C program(not MFC) for windows95(32bit).
This program uses MDI environment. I want to add toolbar and statusbar.
When I open a new child window and dragging it around, it hide some parts of toolbar and statusbar.
These hided parts don't recover even after the child window is dragging away.
What is the appropriate message which I should process to make my toolbars and statusbars intact.

Thank you in advance.
0
Comment
Question by:slumber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
DmitryC earned 100 total points
ID: 1414102
Hi.

I think, your problem is that in WM_SIZE handler your mdi client window is sized to whole client area of the frame window. Since you insert toolbar/status bar on top/bottom of the frame's clent area, they owerlap each other.
To solve the problem, you have to forward the original WM_SIZE to toolbar/status bar (they will resize themselves appropriately) and after that move MDIClient window to the area not occupied by tool/status bars (here I use GetEffectiveClientRect):

LRESULT MsgSize(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
    SendMessage(hWndToolbar, uMessage, wparam, lparam);
    SendMessage(hWndStatusbar,  uMessage, wparam, lparam);

    // Position the MDI client window between the tool and status bars
    if (wparam != SIZE_MINIMIZED)
    {
            RECT rcClient;
        //  Data structure used when calling GetEffectiveClientRect (which takes into
        //  account space taken up by the toolbars/status bars).  First half of the
        //  pair is zero when at the end of the list, second half is the control id.
        int s_EffectiveClientRectData[] = { //the same used for ShowHideMenuCtl(...)
            1, 0,                               //  For the menu bar, but is unused
                  1, INT(ID_TOOLBAR),
                  1, INT(ID_STATUSBAR),
            0, 0                                //  First zero marks end of data
        };

        GetEffectiveClientRect(hwnd, &rcClient, s_EffectiveClientRectData);

        MoveWindow(hwndMDIClient,
                   rcClient.left,
                   rcClient.top,
                   rcClient.right-rcClient.left,
                   rcClient.bottom-rcClient.top,
                   TRUE);
    }

    return 0 ;
}

0
 

Author Comment

by:slumber
ID: 1414103
Dear DmitryC:

Your code seems to be fine.
But even after I insert it inside my WM_SIZE(in framewndproc) handler, I have same
problem. My child windows can still hide toolbar and statusbar.
When I maximize a child window, it cover whole area of my frame window(except
menubar). Should I use put some extra code when I create child window?
Or Should I put something inside my childwindowproc?

Thank you in advance.


0
 

Expert Comment

by:DmitryC
ID: 1414104
Hi.

Actually, if your child windows are really MDICHILDs, they can not be larger than their parent - MDICLIENT.

1. Are you sure, your MDICHILD's parent is MDICLIENT, not frame window, and you creating MDICHILDs in proper way?

2. Does your MDICLIENT occupy only area not taken by tool/status bars?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question