What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Get window width...

Get window width...
Author: Message:
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. Get window width...
How would I go about getting the width in pixels of a window? I've tried using GetWindowRect but I can't get it right...:(
07-25-2006 07:00 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Get window width...
code:
var RECT = Interop.Allocate(16);
Interop.Call('User32', 'GetWindowRect', <window handle here>, RECT);
var left = RECT.ReadDWORD(0);
var right = RECT.ReadDWORD(8);
var width = right - left;
07-25-2006 07:17 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. RE: Get window width...
Oh...I didn't know which one was the right I guess :P Which ones are the Top/Bottom?

This post was edited on 07-25-2006 at 07:31 PM by deAd.
07-25-2006 07:30 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Get window width...
quote:
typedef struct _RECT {
  LONG left;
  LONG top;
  LONG right;
  LONG bottom;
} RECT, *PRECT;

source: MSDN

so .ReadDWORD(4) = top
and ReadDWORD(12) = bottom
;)
07-25-2006 07:33 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. RE: Get window width...
I would've guessed that it went 1,2,3,4 ;) :P (or 0,1,2,3)

This post was edited on 07-25-2006 at 07:46 PM by deAd.
07-25-2006 07:46 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Get window width...
quote:
Originally posted by deAd
I would've guessed that it went 1,2,3,4 ;) :P (or 0,1,2,3)
Before you can use Datablocs you should understand the amount of memory that needs to be allocated for each variable type.

Too lazy to type it all out so here is what Choli posted in the beta forum.

quote:
Originally posted by Choli
Long: 4
Integer: 2
Byte: 1
String: 4 (you need to create another datablock and in these 4 byte you write the pointer to the datablock)
String * n: 2*n (unicode) (n if ansi, i don't suggest using ansi)
Enum: 4
Boolean: 2
Double: 8
Single: 4
Variant: 16 (i don't think you'll ever use this)
07-25-2006 08:13 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
O.P. RE: Get window width...
Oh...I've used datablocs before but I've never seen this. Thanks (y)
07-25-2006 09:33 PM
Profile 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