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

OnEvent_ChatWndEditKeyUp
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: OnEvent_ChatWndEditKeyUp
js code:
var oChatWnds = {};
/*Remarks

Because this event is fired for every single key pressed by the user, your event handler must return as fast as possible and not slow down the user.*/

function OnEvent_ChatWndEditKeyDown( pChatWnd, nKeyCode, bCtrl, bShift ) {
    if ( nKeyCode === 0xD /* VK_RETURN */ && bShift == false && bCtrl == false ) {
        oChatWnds[ pChatWnd.Handle ] = {};
            oChatWnds[ pChatWnd.Handle ].Counter = 0;
            oChatWnds[ pChatWnd.Handle ].pChatWnd = pChatWnd;
        MsgPlus.AddTimer( pChatWnd.Handle, 100 );
        return true;
    }
}

Once you detect this then you can activate a timer that checks GetAsyncKeyState to check if the Enter key is pressed. I would check every milisecond and stop the timer if it is not pressed.

js code:
function OnEvent_Timer( sTimerId ) {
    if ( Interop.Call( 'user32', 'GetAsyncKeyState', 0xD /* VK_RETURN */ ) !== 0 ) {
        oChatWnds[ sTimerId ].Counter++;
        MsgPlus.AddTimer( sTimerId, 100 );
    }
}

This post was edited on 02-04-2009 at 06:14 PM by matty.
02-04-2009 01:22 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
OnEvent_ChatWndEditKeyUp - by Ezra on 02-04-2009 at 12:58 PM
RE: OnEvent_ChatWndEditKeyUp - by matty on 02-04-2009 at 01:22 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