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:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. OnEvent_ChatWndEditKeyUp
Is there any way this event could be created by scripting?

Also did anyone find out how to correctly catch the ENTER with OnEvent_ChatWndEditKeyDown with pure scripting?

I'm trying to detect how long the ENTER key was pressed and only let msn sent the message when it's being held for 5 seconds or so. Hope this is possible.
[Image: 1-0.png]
             
02-04-2009 12:58 PM
Profile PM Web Find Quote Report
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 »


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