Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RECT Help:

Posted on 2000-04-17
7
Medium Priority
?
344 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
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

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.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

971 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