Solved

windows  given handle return window size  x, y

Posted on 2007-12-01
8
182 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
Comment Utility
In Windows, the GetWindowRect API will do the trick.  See
   http://msdn2.microsoft.com/en-us/library/ms633519.aspx
0
 

Author Comment

by:Troudeloup
Comment Utility
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
Comment Utility
acutally, i made a mistake  :(


what I want to know is, WHERE is the window is.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 300 total points
Comment Utility
using GetWindowRect():

RECT rect;
GetWindowRect(hWnd, &rect);
int x = rect.left;
int y = rect.top;
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:Troudeloup
Comment Utility
yep. that works.


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

Assisted Solution

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

Author Comment

by:Troudeloup
Comment Utility
ahhhhh. how clever :)
0
 
LVL 13

Expert Comment

by:josgood
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now