Shoutbox

Detecting things - 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 things (/showthread.php?tid=68970)

Detecting things by Jimbo on 11-29-2006 at 07:51 PM

Any way to detect when the main messenger window is minimized/maximised/closed? Thanks


RE: Detecting things by roflmao456 on 11-29-2006 at 09:32 PM

code:
Messenger.ContactListWndHandle

try using that? its in the scripting documentation

quote:
The Messenger::ContactListWndHandle property returns the window's handle of the contact list window, if currently opened.

Syntax


This is a read-only property.
[handle] ContactListWndHandle;

Data Type


If the contact list is closed, the return value is 0. The handle is a HWND object and must be used as is. It can be passed as parameter of various Windows API functions like SendMessage.


RE: Detecting things by Spunky on 11-29-2006 at 10:14 PM

Note that only shows whether the window is open or closed, not minimized or maximized...


RE: Detecting things by matty on 11-29-2006 at 10:32 PM

code:
var WindowPlacment = Interop.Allocate(48);

function OnEvent_Initialize(bMessengerStart){
    if (Messenger.ContactListWndHandle){
        _getPlacement(Messenger.ContactListWndHandle);
    }
}

function _getPlacement(hWnd){
    if (hWnd > 0){
        Interop.Call('user32', 'GetWindowPlacement', hWnd, WindowPlacement);
       
        Debug.Trace('> .showCmd : '+WindowPlacement.ReadDWORD(8));
        if (WindowPlacement.ReadDWORD(8) == 3){
            Debug.Trace(' > .showCmd : Maximized');
        } else if (WindowPlacement.ReadDWORD(8) == 2){
            Debug.Trace(' > .showCmd : Minimized');
        } else if (WindowPlacement.ReadDWORD(8) == 1){
            Debug.Trace(' > .showCmd : Opened');
        }
    } else {
        Debug.Trace(' > .showCmd : Closed');
    }
}

quote:
typedef struct _WINDOWPLACEMENT {
    UINT length;
    UINT flags;
    UINT showCmd;
    POINT ptMinPosition;
    POINT ptMaxPosition;
    RECT rcNormalPosition;
} WINDOWPLACEMENT;