Solved

MDI and TOOLBAR

Posted on 1998-03-10
4
632 Views
Last Modified: 2013-12-03
I am using WIN32 API to create a Window application that have MDI and Toolbar.
The MDI application work fine with the toolbar except that the ToolBar seems to be draw on the client area eventhough I created the toolbar in the frame window. When the app create a child window, the top portion of the child window is covered by the toolbar.

Does anybody have any suggestion how to fix this?
 
0
Comment
Question by:klt
[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
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1411882
If you look at how MFC fixes this problem, you'll see that the toolbar is a child of the frame. The MDI client window has been resized to match the area not taken by the toolbar. All MDI children are children of the MDI client window, so if the MDI client has been resized to not overlap with the toolbar, then neither will the MDI children.
0
 

Author Comment

by:klt
ID: 1411883
Thanks Thui,

I know the theory. However, My application initially created the toolbar and the MDI Client overlap to each other. How can I change my code so that they will not overlap to each other? Is that anything I need to set in order to make them not overlap to each other initially? Can you give me a little more detail how to fix it or point me to some sample code with MDI and Toolbar? I could not find any sample code with MDI and Toolbar in MSDN though.

Following code show how I create the Toobar:

case WM_CREATE:

           hWndToolbar = CreateToolbarEx(
                                   hWnd,                        // parent
                                   WS_CHILD| WS_BORDER| WS_VISIBLE |
                                   TBSTYLE_TOOLTIPS, // window style
                                   IDR_TOOLBAR,           // toolbar id
                                   8,                               // number of bitmaps
                                   ghInstance,                 // mod instance
                                   IDB_TOOLBAR,      // resource ID for bitmap
                                  (LPCTBBUTTON)&tbButtons,  
                                   5,                        
                                  16,16,                    
                                  16,16,                    
                                  sizeof(TBBUTTON));  

                 if (hWndToolbar == NULL )
                     {
                        MessageBox (NULL, "Tool not created!", NULL, MB_OK );
                        return 0;
                     }

Thanks again!
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1411884
Trap WM_SIZE in the MDI frame and given the size of the frame, reposition and resize your MDI client and toolbar so they do not overlap. Calculate the new rectangles for the toolbar and client based on the frame's new size.



0
 

Author Comment

by:klt
ID: 1411885
Thanks!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

632 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