Solved

Toolbar and Statusbar in a MDI environment?

Posted on 1998-09-01
3
856 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
  • 2
3 Comments
 

Accepted Solution

by:
DmitryC earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now