Shoutbox

Detecting Window Resize - 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: Detecting Window Resize (/showthread.php?tid=67900)

Detecting Window Resize by Spunky on 10-31-2006 at 04:11 PM

Is there any way to detect this as an event or just have something check? I wan't it to check for when the contact list is resized. I think I could possibly use the Messenger API, but I want to avoid this if it's possible. Else I think this may be my only alternative


RE: Detecting Window Resize by RaceProUK on 10-31-2006 at 10:48 PM

Detecting a window resize is not possible via the Messenger API. What you need to use is a Windows Message Hook, both the CallWndProc and GetMessage types, and look for window messages such as WM_SIZE.


RE: Detecting Window Resize by Spunky on 10-31-2006 at 10:57 PM

quote:
Originally posted by RaceProUK
Detecting a window resize is not possible via the Messenger API. What you need to use is a Windows Message Hook, both the CallWndProc and GetMessage types, and look for window messages such as WM_SIZE.

Thanks for the help and info on where I should start. I'll try it. I was going to use the Messenger API to get the width, and then check it with a timer... so it kinda was possible :p

RE: Detecting Window Resize by deAd on 10-31-2006 at 11:01 PM

A simpler way using just scripts:

Use a timer (100 ms interval for fastest detection) and the
GetWindowRect function to check for changes. When the contact list is destroyed (there's an event) stop all timers and don't create new ones. When it's created resume timing.

quote:
Thanks for the help and info on where I should start. I'll try it. I was going to use the Messenger API to get the width, and then check it with a timer... so it kinda was possible :p
That would've worked, except the Messenger API would (1) take a while to initialize, (2) make Windows Messenger run, (3) not be the fastest way to get the width, and (4) not even work all the time. :P
RE: Detecting Window Resize by RaceProUK on 10-31-2006 at 11:18 PM

quote:
Originally posted by deAd
Use a timer (100 ms interval for fastest detection)
OMFG ewwww! Do you have any idea how goddam slow polling can be? Using that much effort just to check a window size: it's a total waste of CPU cycles. That's why I suggested window messages. They are much more efficient, as they're designed as an event-reponse mechanism.
RE: Detecting Window Resize by deAd on 10-31-2006 at 11:44 PM

quote:
Originally posted by RaceProUK
quote:
Originally posted by deAd
Use a timer (100 ms interval for fastest detection)
OMFG ewwww! Do you have any idea how goddam slow polling can be? Using that much effort just to check a window size: it's a total waste of CPU cycles. That's why I suggested window messages. They are much more efficient, as they're designed as an event-reponse mechanism.
True, but I was simply suggesting a way to do it without DLLs. I never said it was a good approach :P
RE: Detecting Window Resize by Spunky on 10-31-2006 at 11:46 PM

quote:
Originally posted by deAd
That would've worked, except the Messenger API would (1) take a while to initialize, (2) make Windows Messenger run, (3) not be the fastest way to get the width, and (4) not even work all the time.

Messenger doesn't run on my PC (checked processes too)


quote:
Originally posted by deAd
True, but I was simply suggesting a way to do it without DLLs. I never said it was a good approach 

It doesn't use DLLs it uses API calls. :p

RE: Detecting Window Resize by deAd on 10-31-2006 at 11:53 PM

quote:
Originally posted by SpunkyLoveMuff
quote:
Originally posted by deAd
True, but I was simply suggesting a way to do it without DLLs. I never said it was a good approach 

It doesn't use DLLs it uses API calls. :p
You'll need DLLs because you can't get/pass a function pointer.
RE: Detecting Window Resize by CookieRevised on 11-01-2006 at 04:19 PM

quote:
Originally posted by SpunkyLoveMuff
quote:
Originally posted by deAd
That would've worked, except the Messenger API would (1) take a while to initialize, (2) make Windows Messenger run, (3) not be the fastest way to get the width, and (4) not even work all the time.
Messenger doesn't run on my PC (checked processes too)
it is "Windows Messenger"..., not "msn messenger", nor "windows live messenger". It will run when you invoke the Messenger API.
RE: Detecting Window Resize by Spunky on 11-01-2006 at 04:45 PM

quote:
Originally posted by CookieRevised
it is "Windows Messenger"..., not "msn messenger", nor "windows live messenger". It will run when you invoke the Messenger API.

I know, it does not run on my PC... Don't know why. There is not a single instance of it. Yet I can open it through the shortcut etc.
RE: Detecting Window Resize by RaceProUK on 11-01-2006 at 06:53 PM

It depends exactly how the API is instantiated. If it's via CreateObject() or similar, Windows Messenger will run. Other means won't necessarily do that.


RE: Detecting Window Resize by Spunky on 11-01-2006 at 06:57 PM

code:
try{
var MessengerAPI = new ActiveXObject("Messenger.UIAutomation.1");
} catch(exception){
Debug.Trace("Error occured creating the messenger API object, make sure you have windows messenger installed");
}
        var MessengerWnd = MessengerAPI.IMessengerWindow;
        MessengerWnd = MessengerAPI.Window;

Thats how I'm calling it... Doesn't seem to do any harm :p
RE: Detecting Window Resize by vikke on 11-01-2006 at 07:07 PM

Spunky: You'll need CALLBACK function in your hook procedure (it's the Windows Message Event). To create that, you'll need a dll. That's why scripting can't hook without a dll.


RE: RE: Detecting Window Resize by CookieRevised on 11-02-2006 at 01:33 AM

quote:
Originally posted by SpunkyLoveMuff
code:
try{
var MessengerAPI = new ActiveXObject("Messenger.UIAutomation.1");
} catch(exception){
Debug.Trace("Error occured creating the messenger API object, make sure you have windows messenger installed");
}
        var MessengerWnd = MessengerAPI.IMessengerWindow;
        MessengerWnd = MessengerAPI.Window;

Thats how I'm calling it... Doesn't seem to do any harm :p

It also isn't the complete Messenger API but only a very small part of it.