Solved

Toolbar and Statusbar in a MDI environment?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
MSDN Subscription - Azure and NFP's 3 75
Application vs Workbook.applicaiton 3 41
Visual Studio 2015 locks debug executable 9 215
Recommendation vb6 to vb.net or others 14 176
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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 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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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