using System; using System.Diagnostics; using System.Runtime.InteropServices; public class TaskbarRefresher { // Find and kill the taskbar window [DllImport("user32.dll", SetLastError = true)] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
private static void RestartShellComponents() { // Use Windows API to restart the shell try { // Start a new explorer instance (which will recreate the taskbar) Process.Start("explorer.exe"); } catch { } } refresh taskbar
[DllImport("user32.dll")] private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); using System; using System
[DllImport("user32.dll")] private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); refresh taskbar