Solved

RECT Help:

Posted on 2000-04-17
7
319 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SetCurrentDirectory path limit 7 122
mixing C++ & C# in Vis Studio 2013 7 177
Dialogbox API leak? 18 96
What is sub-make ? 2 61
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

803 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