• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • 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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Jaime OlivaresSoftware ArchitectCommented:
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 OlivaresSoftware ArchitectCommented:
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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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