
private static void RestartExplorer() { // Kill all explorer processes foreach (var process in Process.GetProcessesByName("explorer")) { try { process.Kill(); } catch { } } // Wait for processes to end System.Threading.Thread.Sleep(1000); // Start fresh explorer Process.Start("explorer.exe"); } } using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; public class AdvancedTaskbarRefresher { [DllImport("user32.dll", SetLastError = true)] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
private const uint WM_CLOSE = 0x0010;
[DllImport("user32.dll")] private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); refresh taskbar