?
Solved

Toolbar and Statusbar in a MDI environment?

Posted on 1998-09-01
3
Medium Priority
?
877 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 200 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

752 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