Solved

windows  given handle return window size  x, y

Posted on 2007-12-01
8
187 Views
Last Modified: 2010-04-01
is there such a thing?
0
Comment
Question by:Troudeloup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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…
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.

696 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