Shoutbox

help with msgplus windows please - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: help with msgplus windows please (/showthread.php?tid=78739)

help with msgplus windows please by waynewilson2 on 11-04-2007 at 07:43 PM

i was just wondering, how, if its possible, to change the width of a Msg Plus Window that i created, i have a var assigned to it, it is 'tehwin' but the way i want to change the size of it is by using a button, or command.
Thanks In Advance

---Wayne Wilson


RE: help with msgplus windows please by Matti on 11-04-2007 at 07:57 PM

Here you go! For more options, check out the SetWindowPos MSDN page. ;)

code:
function SetWindowSize(PlusWnd, Width, Height) {
   var HWND_TOP = 0;
   var SWP_NOMOVE = 0x2;
   var SWP_NOZORDER = 0x4;
   Interop.Call("user32", "SetWindowPos", PlusWnd.Handle, HWND_TOP, 0, 0, Width, Height, SWP_NOMOVE | SWP_NOZORDER);
}

//Usage
SetWindowSize(tehwin, 500, 400);

RE: help with msgplus windows please by waynewilson2 on 11-04-2007 at 08:04 PM

thanks

code:
        if (PlusWnd.Height > 63){
            SetWindowSize(tehwin, 533, 310);
        }else{
            SetWindowSize(tehwin, 533, 62.5);
        }

can you tell me whats wrong with this? it changes to the smaller size, but not back to the bigger one...
RE: help with msgplus windows please by ArkaneArkade on 11-04-2007 at 09:39 PM

What do you mean "won't change back to the bigger"? Are you clicking the same button twice, or are you manually resizing the window before calling the function?

I'll guess that you need to change "if (PlusWnd.Height > 63)" to "if (PlusWnd.Height < 63)" (less than).  Can't be sure this would be your issue but it's the only thing making sense to me immediately.


RE: help with msgplus windows please by waynewilson2 on 11-05-2007 at 01:07 AM

quote:
Originally posted by Leroux
What do you mean "won't change back to the bigger"? Are you clicking the same button twice, or are you manually resizing the window before calling the function?

I'll guess that you need to change "if (PlusWnd.Height > 63)" to "if (PlusWnd.Height < 63)" (less than).  Can't be sure this would be your issue but it's the only thing making sense to me immediately.

nah, greater than is what its supposed to be, and each way it should resize the window...

the way it should be is
if (PlusWnd.Height > 63){
will check if the window is taller than 63px, and if it is then it will make it smaller, and otherwise, it returns it to the original size, but it will only call the else, it will not call the main portion...i tried changing the symbol to greater than, and still nothing...
RE: help with msgplus windows please by roflmao456 on 11-05-2007 at 01:11 AM

i think you can use Interop for this; you can try using a variable (boolean) instead.

i think "PlusWnd.Height" only returns the height that's in the XML.


RE: help with msgplus windows please by ArkaneArkade on 11-05-2007 at 01:16 AM

OK, my mistake.  As I said, I know nothing of windows.
It's not that  you're stating (PlusWnd.Height > 63).  PlusWnd is only really the identifier used in the MPLScripting docs, so shouldn't it be (tehwin.Height > 63). 
That would explain why it always calls the else - if no window by name of PlusWnd exists, then none can be >/</= to anything, so it will always be the else clause.


RE: help with msgplus windows please by waynewilson2 on 11-05-2007 at 05:36 AM

quote:
Originally posted by Leroux
OK, my mistake.  As I said, I know nothing of windows.
It's not that  you're stating (PlusWnd.Height > 63).  PlusWnd is only really the identifier used in the MPLScripting docs, so shouldn't it be (tehwin.Height > 63). 
That would explain why it always calls the else - if no window by name of PlusWnd exists, then none can be >/</= to anything, so it will always be the else clause.

no...its in a control click function...tehwin and PlusWnd do the same thing
RE: help with msgplus windows please by Volv on 11-05-2007 at 05:47 AM

Err, I think the most important problem here is that Pluswnd.Height is not a valid property...

The only valid properties for a PlusWnd Object are
PlusWnd.Handle
PlusWnd.Visible
PlusWnd.WindowId


RE: help with msgplus windows please by waynewilson2 on 11-05-2007 at 05:48 AM

ok, then how would i get the height of the window?? lol


RE: help with msgplus windows please by Volv on 11-05-2007 at 06:07 AM

I imagine you would have to use something like (thanks to dt):

code:
var theRECT = Interop.Allocate(16); //long = 4 so size = 4 * 4//

Interop.Call("user32", "GetWindowRect", PlusWnd.Handle, theRECT);

    var left = theRECT.ReadDWORD(0); //left
    var top = theRECT.ReadDWORD(4); //Top
    var right = theRECT.ReadDWORD(8 ); //Right
    var bottom = theRECT.ReadDWORD(12); //Bottom

var WndWidth = right - left;


RE: help with msgplus windows please by waynewilson2 on 11-05-2007 at 06:08 AM

ok, thnx