[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1052
  • Last Modified:

GetClientRect() without scrollbar and toolbar area?

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
koenig
Asked:
koenig
  • 2
1 Solution
 
mbhaktaCommented:
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
 
koenigAuthor Commented:
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
 
mbhaktaCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now