quote:
js code:
...
var hWnd = Interop.Call("user32", "FindWindowW", "msblpopupmsgwclass", 0); // Find the toast window
if(hWnd != null){ // If we found one
Interop.Call ( 'user32' , 'SendMessageW' , hWnd , WM_CLOSE, 0 , 0 ) ; // Close it
}
...
You might wanna repeat that until you don't find any windows anymore. There could be multiple toasts at the same moment.
Also, that code is not polygamy safe (every code should be made polygamy safe if possible).
This will fix all that:
js code:
...
var tIDCurrent = Interop.Call('Kernel32', 'GetCurrentThreadId');
var hWnd = 0;
while (hWnd = Interop.Call('User32', 'FindWindowW', 'MSBLPopupMsgWClass', 0)) {
if (Interop.Call('User32', 'GetWindowThreadProcessId', hWnd, 0) === tIDCurrent) {
Interop.Call ('User32', 'SendMessageW', hWnd ,WM_CLOSE, 0, 0)
}
}
...
-----
PS: SourSpud, it would still be better to actually turn off the option in Messenger though! Script like this are process intensive and might slow things down because of the use of that timer. Also, Plus! toasts aren't hidden by this. So you still need to disable some options in preferences anyways.