Solved

Toolbar and Statusbar in a MDI environment?

Posted on 1998-09-01
3
859 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

770 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