Improve company productivity with a Business Account.Sign Up

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

RECT Help:

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
Toad224
Asked:
Toad224
  • 5
1 Solution
 
mnewton022700Commented:
Use CWnd::GetClientRect and CWnd::ClientToScreen.

eg.

CRect clientRect;
this->GetClientRect(clientRect);
this->ClientToScreen(clientRect);
0
 
xLsCommented:
use GetClientRect();
0
 
mnewton022700Commented:
Sorry, I've got MFC on the brain. The non-MFC way would be:

RECT rect;

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

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
mnewton022700Commented:
You'll need to convert the client coordinates to screen coordinates to work out the actual position of the window.
0
 
mnewton022700Commented:
You need the ClientToScreen call to convert the client coordinates to screen coordinates so that you have the actual position of the window.

0
 
Toad224Author Commented:
Why didn't you make yours an answer, mnewton?
0
 
mnewton022700Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

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