August 25th, 2012, 12:45 PM
How to add a toolbar to the MDI interface?
Hello, I am rather new to Windows programming and I am writing a C application using the Win32 APIs.
My application should look more or less like the picture in this old (but not outdated) msdn example:
I mean: a frame window with a menu and a toolbar, the MDI client window and several child windows. Apparently the most common interface for an (old-style) application.
I am creating the MDI components as described in the official documentation:
The critical line seems to be:
The MDI client takes the whole client area of the frame window, as it should be, even if I have assigned a size of (0,0). All is fine, up to this moment. Now I am trying to add a toolbar according to msdn. I have taken the code from:
hwndMDIClient = CreateWindow( "MDICLIENT", (LPCTSTR) NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
0, 0, 0, 0, hwnd, (HMENU) 0xCAC, hInst, (LPSTR) &ccs);
It compiles without errors and I can see the toolbar. The problem is that, as soon as I create the first document (child window), the latter covers the toolbar. I need a way to tell the MDI client not to take the whole client area of the frame window, but only the bottom part of it, just like you would expect from any application. The toolbar should not be covered by the document windows.
Can you please tell me if there is a downloadable example of a simple MDI application that I can study? Possibly written in C (not in C++) ? Alternatively: is there a simple way to restrict the area available to the MDI client window?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.