private void CleanupNotificationArea() { // Parse the window hierarchy to find the notification area and // send mouse move events to get rid of zombie icons. string[] classes = { "Shell_TrayWnd", "TrayNotifyWnd", "SysPager" }; string[] names = { "User Promoted Notification Area", "Notification Area" }; IntPtr window = IntPtr.Zero; foreach (var win_class in classes) { window = NativeMethods.FindWindowEx(window, IntPtr.Zero, win_class, ""); } foreach (var win_name in names) { var area = NativeMethods.FindWindowEx(window, IntPtr.Zero, "ToolbarWindow32", win_name); if (area == IntPtr.Zero) { continue; } RECT rect; NativeMethods.GetClientRect(area, out rect); for (int y = rect.Top + 4; y < rect.Bottom; y += 8) { for (int x = rect.Left + 4; x < rect.Right; x += 8) { NativeMethods.PostMessage(area, (uint)WM.MOUSEMOVE, 0, (y << 16) | x); } } } }