quote:
Originally posted by SpunkyLoveMuff
EDIT: As for exiting WLM completely, I think it's possible if I can find a way to close processes (or include an exe that can do it and open it from the script)
warning: don't attempt that if you don't know how... closing messenger in that way will brute force close it and things will not be saved properly. Many errors, including crashes and data loss can happen...
Scripts are run from inside Plus!, which on its turn is run from inside Messenger. Closing Messenger that way will forcefully break down that whole pyramid instead of nicely exiting step by step.
eg: Plus! needs time to wraps things up, Messenger needs time to wrap things up, etc...
---------------
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)....
I'm even not sure if the handle gets closed. It might be possible that this is done automatically, but I'm certainly not certain. You would need to check what will happen with a handle created from within the process you are closing in the Windows API docs or even by monitoring the Windows handles for a possible handle leakage.
I'm not convinced that that code is safe.