Solved

windows  given handle return window size  x, y

Posted on 2007-12-01
8
185 Views
Last Modified: 2010-04-01
is there such a thing?
0
Comment
Question by:Troudeloup
  • 4
  • 2
  • 2
8 Comments
 
LVL 13

Accepted Solution

by:
josgood earned 200 total points
ID: 20390131
In Windows, the GetWindowRect API will do the trick.  See
   http://msdn2.microsoft.com/en-us/library/ms633519.aspx
0
 

Author Comment

by:Troudeloup
ID: 20390139
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
 

Author Comment

by:Troudeloup
ID: 20390141
acutally, i made a mistake  :(


what I want to know is, WHERE is the window is.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 300 total points
ID: 20390144
using GetWindowRect():

RECT rect;
GetWindowRect(hWnd, &rect);
int x = rect.left;
int y = rect.top;
0
 

Author Comment

by:Troudeloup
ID: 20390147
yep. that works.


how about, WHERE is the window is?
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 300 total points
ID: 20390151
my code tells you where the window is, that is, the top-left corner.
0
 

Author Comment

by:Troudeloup
ID: 20390152
ahhhhh. how clever :)
0
 
LVL 13

Expert Comment

by:josgood
ID: 20390158
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

839 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