Solved

GetClientRect() without scrollbar and toolbar area?

Posted on 1997-03-18
3
944 Views
Last Modified: 2013-11-20
I'd like to maximze my ChildWindows (MDI app) during startup in vertical direction with fixed horizontal size. I try to get the y size by a call to AfxGetMainWnd->GetClientRect(), but this size seems to be with tool and statusbar, so parts of my childwindows are occluded.
How do I get the correct size to set my childwindows?
0
Comment
Question by:koenig
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
mbhakta earned 30 total points
Comment Utility
There are various ways of doing this. One way is of doing this is as follows :

Use API GetNextWindow() in a recursive loop to enumerate all the child windows under AfxGetMainWnd(). (Alternately, EnumWindows() can also be used). Once, you have the handle get the classname of that window using GetClassName(). If the class name is 'MDIClient' get the Windowrect and you are done.....

0
 

Author Comment

by:koenig
Comment Utility
sorry, good, not even a close hit.
don't get confused by the term "maximize"! I want do do a Movewindow() with my own coords and size.
question is: how do I get the maximum y size for my childwindows? GetClientRect() of parent window gives my size without tool-, scroll-, and statusbar...
0
 
LVL 4

Expert Comment

by:mbhakta
Comment Utility
You had a pretty cryptic question and just 30 points, so what more can you expect ? I can't read your mind. Now that you have explained more about your problems here is a solution.

The clientrect you get after using the technique I have explained earlier should be added to the other child window's clientrect's viz. Toolbar, statusbar , scrollbars or menu(if you want). This is the maximum client area of the AfxGetMainWnd(), so the x and y are the maximum sizes your childwindows can fit in.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now