Solved

windows  given handle return window size  x, y

Posted on 2007-12-01
8
184 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

770 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