• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

windows given handle return window size x, y

is there such a thing?
0
Troudeloup
Asked:
Troudeloup
  • 4
  • 2
  • 2
3 Solutions
 
josgoodCommented:
In Windows, the GetWindowRect API will do the trick.  See
   http://msdn2.microsoft.com/en-us/library/ms633519.aspx
0
 
TroudeloupAuthor Commented:
ok i feed it a handle.

what's lpoint?


also, since it turns rect, why is it a bool function?

can you show me a code that uses it?

like

rect = getwindowrect( hwnd hwnd )

?

0
 
TroudeloupAuthor Commented:
acutally, i made a mistake  :(


what I want to know is, WHERE is the window is.
0
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.

 
Jaime OlivaresCommented:
using GetWindowRect():

RECT rect;
GetWindowRect(hWnd, &rect);
int x = rect.left;
int y = rect.top;
0
 
TroudeloupAuthor Commented:
yep. that works.


how about, WHERE is the window is?
0
 
Jaime OlivaresCommented:
my code tells you where the window is, that is, the top-left corner.
0
 
TroudeloupAuthor Commented:
ahhhhh. how clever :)
0
 
josgoodCommented:
I agree with jaime_olivares.

The MSDN page that I referenced earlier says "he GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen."

The returned rectangle contains the screen coordinates of the window, where (rect.left,rect.top) gives the coordinates of the upper left corner of the rectangle.  The lower right corner is (rect.right,rect.bottom).  From this you can work out the other two corners.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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