Solved

RECT Help:

Posted on 2000-04-17
7
328 Views
Last Modified: 2010-04-02
I would like to know how I could find out the position where my dialog starts, NOT INCLUDING THE MENU part.  When my application window resizes, I also resize a text box, however when I subtract to calculate the size of the text box, I miscalculate the size if the menu takes up multiple lines, or the user has changed the font / size of the menus.  Please show me how I could find where the rect of my window starts not including the Menu part in C++.
0
Comment
Question by:Toad224
[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
  • 5
7 Comments
 
LVL 3

Expert Comment

by:mnewton022700
ID: 2724707
Use CWnd::GetClientRect and CWnd::ClientToScreen.

eg.

CRect clientRect;
this->GetClientRect(clientRect);
this->ClientToScreen(clientRect);
0
 
LVL 2

Accepted Solution

by:
xLs earned 832 total points
ID: 2724713
use GetClientRect();
0
 
LVL 3

Expert Comment

by:mnewton022700
ID: 2724714
Sorry, I've got MFC on the brain. The non-MFC way would be:

RECT rect;

::GetClientRect(hWnd, &rect);
::ClientToScreen(hWnd, &rect);

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:mnewton022700
ID: 2724722
You'll need to convert the client coordinates to screen coordinates to work out the actual position of the window.
0
 
LVL 3

Expert Comment

by:mnewton022700
ID: 2724727
You need the ClientToScreen call to convert the client coordinates to screen coordinates so that you have the actual position of the window.

0
 
LVL 1

Author Comment

by:Toad224
ID: 2724736
Why didn't you make yours an answer, mnewton?
0
 
LVL 3

Expert Comment

by:mnewton022700
ID: 2724754
You're right, I should have. I generally don't submit answers because it restricts other people from making other constructive comments (sort of anyway). But in this case I should have made my comment an answer.

If you want to you could still decline xLs and accept my comment. Either way,
is fine with me.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

759 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