Shoutbox

Chat Window Focus on Message Received - 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: Chat Window Focus on Message Received (/showthread.php?tid=94191)

Chat Window Focus on Message Received by andrewrc on 03-23-2010 at 02:06 PM

Okay, I'm pretty new to Messenger Plus! (just discovered it yesterday) and even though I know JavaScript, I don't know JScript.

What I'm trying to do is, whenever a new message is received, bring that chat window to the top.

I know it sounds like it would be annoying, but there's a reason why I want to do that. The problem is, if you have a full-screen remote desktop window open, even though you get alerts in the bottom right of the screen... if you minimize a chat window, and get a message when you're not at your computer, you will have no way to know if you got a message or not unless you manually check. So I want the chat window to have focus when it gets a new message.

In most cases, the person using this script will only be talking to one person at a time, so that's not really an issue.

Here's what I have so far... it's probably a piece of crap script - it doesn't work and I'm not sure what to write.

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_ChatWndReceiveMessage(ChatWnd)
{
    BringWindowToTop(ChatWnd);
}

function OnEvent_Uninitialize(MessengerExit)
{
}


Any help would be appreciated!
RE: Chat Window Focus on Message Received by matty on 03-23-2010 at 04:38 PM

Windows API's are used a bit differently than that.

Javascript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd) {
    Interop.Call('user32', 'BringWindowToTopW', ChatWnd.Handle);
}


RE: Chat Window Focus on Message Received by andrewrc on 03-23-2010 at 06:26 PM

Thank you! I'll try that.