What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » function OnGetScriptMenu - ChatWnd

function OnGetScriptMenu - ChatWnd
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: function OnGetScriptMenu - ChatWnd
Ah, I see. Matty didn't test his code properly, and thus he mixed up a few things. :)

This should work fine:
code:
function GetChatWnd() {
    for ( var e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext() ) {
        var oChatWnd = e.item();
        if ( oChatWnd.Handle === Interop.Call('user32', 'GetForegroundWindow' ) {
            return oChatWnd;
        }
    }
    return false;
}
And an implementation example:
code:
function OnGetScriptMenu( nLocation ) {
    if( nLocation === MENULOC_CHATWND ) {
        var oChatWnd = GetChatWnd();
        //Do anything you want with the ChatWnd object here...
        //Maybe you need some error handling in case oChatWnd is false,
        //when the foreground chat window couldn't be found.
    } else {
        //Contact list or mobile chat window
    }
}
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
07-08-2008 11:39 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
function OnGetScriptMenu - ChatWnd - by Suxsem on 07-07-2008 at 12:12 PM
RE: function OnGetScriptMenu - ChatWnd - by Matti on 07-07-2008 at 12:17 PM
RE: function OnGetScriptMenu - ChatWnd - by Suxsem on 07-07-2008 at 12:20 PM
RE: function OnGetScriptMenu - ChatWnd - by matty on 07-07-2008 at 04:08 PM
RE: function OnGetScriptMenu - ChatWnd - by Suxsem on 07-08-2008 at 11:09 AM
RE: function OnGetScriptMenu - ChatWnd - by Matti on 07-08-2008 at 11:39 AM
RE: function OnGetScriptMenu - ChatWnd - by Suxsem on 07-08-2008 at 11:41 AM
RE: function OnGetScriptMenu - ChatWnd - by matty on 07-08-2008 at 01:13 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