quote:
Originally posted by CookieRevised
Matty, if you do use such a code for a forceable close, use the ExitProcess API instead of the TerminateProcess API. See MSDN why.... Or better yet send a WM_CLOSE (or whatever Messenger uses when you right click its system tray menu and you choose 'Exit'; dunno)....
Fixed as per Cook's instructions.
code:
/*
Function: ExitWindowsLiveMessenger()
- Function will forcfully close Windows Live Messenger without giving it the opportunity to save the settings pending the successful shutdown of the application.
*/
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
/* Check if the message sent is to exit Windows Live Messenger */
if (sMessage === '/exit'){
ExitWindowsLiveMessenger();
}
}
function ExitWindowsLiveMessenger() {
/* Exit the process */
function ExitWindowsLiveMessenger() {
/* Exit the process */
Interop.Call('kernel32',
'ExitProcess',
Interop.Call('kernel32',
'GetExitCodeProcess',
Interop.Call('kernel32',
'GetCurrentThreadId'),
0)
);
}