What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Getting the exact window position?

[?] Getting the exact window position?
Author: Message:
effection
Full Member
***

Destroy The Runner

Posts: 135
Reputation: 4
– / Male / Flag
Joined: Sep 2006
O.P. [?] Getting the exact window position?
I know that GetWindowRect gets the size of the window relevant to the top left corner of the window but is there anyway to get the position of the window relevant to the top left corner of the full screen?
12-24-2006 05:07 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: [?] Getting the exact window position?
I think you need GetWindowPos :)
12-24-2006 06:16 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [?] Getting the exact window position?
quote:
Originally posted by effection
I know that GetWindowRect gets the size of the window relevant to the top left corner of the window but is there anyway to get the position of the window relevant to the top left corner of the full screen?
You got your info a bit wrong there, and as such you actually answered your own question ;)

It is GetWindowRect which you need to use. Coordinates are given in screen coordinates that are relative to the upper-left corner of the screen.

This means you can know the position of the window relative to the screen as well as it size by either taking the coordinates in its 16 byte long RECT structure as-is, or by doing right - left and top - bottom.

quote:
Originally posted by Mnjul
I think you need GetWindowPos :)

SetWindowPos exists, but not GetWindowPos


------------------------------------------------------------

So you need to use either:
GetWindowRect
GetWindowRgn (if window is not rectangular)
GetWindowInfo (if you also need other info at the same time)

all defined in User32.dll


;)

This post was edited on 12-24-2006 at 06:50 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-24-2006 06:28 PM
Profile PM Find Quote Report
effection
Full Member
***

Destroy The Runner

Posts: 135
Reputation: 4
– / Male / Flag
Joined: Sep 2006
O.P. RE: [?] Getting the exact window position?
ah right i see im stupid i didnt look at the code right!
i seen
code:
Interop.Call("User32", "GetWindowRect", Handle * 1, RECT);

var CurWidth = RECT.ReadDWORD(8) - RECT.ReadDWORD(0);

and didn't realise that it was getting the coords then from that working out the width *hits head*
12-24-2006 08:45 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On