What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - Resizing a child window!

HELP - Resizing a child window!
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: HELP - Resizing a child window!
Actually, SetWindowPos is the right function for this. I've had many trouble before using MoveWindow, and SetWindowPos was always the answer. :P

Anyway, I've done this in my Countdown Live script in the same way as SmokingCookie said. Here's how:
  1. Place the RetrievePos function of SmokingCookie somewhere in your script.
  2. Create your window and child window as you normally would. After creation, register WM_SIZE on your parent.
    Javascript code:
    WndCommandBar_Shell.RegisterMessageNotification(/* WM_SIZE */ 0x5, true);

  3. Create a handler for the message notification event. Check the Message parameter and when you got WM_SIZE, you can resize the child window like so:
    Javascript code:
    // Get the place-holder's position
    var posChild = RetrievePos(WndCommandBar_Shell, "PlhChild");
    // SetWindowPos flags
    var flagsSWP = /* SWP_NOACTIVATE */ 0x10 | /* SWP_NOMOVE */ 0x2;
    // Position the child
    Interop.Call("user32", "SetWindowPos", WndCommandBar_CMain.Handle, 0, 0, 0, posChild.Width, posChild.Height, flagsSWP);
    // Done!

I assume that on creation, the child window's size matches that of the place-holder. If not, execute the code provided for the message notification event also just after registering the notification.

On a side note, here's a nifty trick: when you need to get the new size of the window inside the WM_SIZE handler, you can do this without having to call GetWindowRect! The lParam contains the width in the low-order word and the height in the high-order word, so all you have to do is:
Javascript code:
var wWidth = lParam & 0xFFFF; //Get low-order word
var wHeight = (lParam >> 16); //Get high-order word

And tadaa, you saved yourself another call to the Win32 API! :D

Finally, I managed to beat someone instead of being beaten! :P

This post was edited on 09-12-2009 at 03:35 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-12-2009 03:32 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP - Resizing a child window! - by whiz on 09-12-2009 at 01:28 PM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-12-2009 at 02:24 PM
RE: HELP - Resizing a child window! - by whiz on 09-12-2009 at 02:35 PM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-12-2009 at 02:49 PM
RE: HELP - Resizing a child window! - by whiz on 09-12-2009 at 03:09 PM
RE: HELP - Resizing a child window! - by Matti on 09-12-2009 at 03:32 PM
RE: HELP - Resizing a child window! - by whiz on 09-13-2009 at 09:59 AM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-12-2009 at 03:33 PM
RE: HELP - Resizing a child window! - by Matti on 09-12-2009 at 03:42 PM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-12-2009 at 03:46 PM
RE: HELP - Resizing a child window! - by Matti on 09-13-2009 at 10:10 AM
RE: HELP - Resizing a child window! - by whiz on 09-13-2009 at 10:33 AM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-14-2009 at 07:39 AM
RE: HELP - Resizing a child window! - by whiz on 09-14-2009 at 03:55 PM
RE: HELP - Resizing a child window! - by Matti on 09-14-2009 at 05:20 PM
RE: HELP - Resizing a child window! - by SmokingCookie on 09-14-2009 at 05:20 PM
RE: HELP - Resizing a child window! - by whiz on 09-14-2009 at 05:58 PM


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