I wasn't at home when I coded this so I wasn't able to test it. However it is fixed!
code:
/*
This is a simple script to detect when the user presses the
escape key, the Messenger Contactlist will close.
Coded by Matty
Request from: http://shoutbox.menthix.net/showthread.php?tid=73662
*/
function OnEvent_Initialize(bMessengerStart){
/* Create a timer to monitor the window and the keys pressed */
MsgPlus.AddTimer('_minimize_window', 100);
}
function OnEvent_Timer(sTimerId){
/* Check to see if the contactlist is the focused window */
if (Interop.Call('user32', 'GetForegroundWindow') === Messenger.ContactListWndHandle){
/* Check to see if we press the escape key */
if (Interop.Call('user32', 'GetAsyncKeyState', 0x1b /* VK_ESC */) !== 0){
/*
Looks like we pressed the escape key, so lets close the window
We send a WM_CLOSE to the window using the SendMessageW api
*/
Interop.Call('user32', 'SendMessageW', Messenger.ContactListWndHandle, 0x10 /* WM_CLOSE */, 0, 0);
}
}
/* Readd the timer no matter what so that we can keep monitoring the windows */
MsgPlus.AddTimer('_minimize_window', 100);
}