Win32 API
[DllImport("user32.dll")]
private static extern int FindWindow(string ClassName, string WindowName);
[DllImport("user32.dll")]
private static extern int ShowWindow(int handle, int cmdShow);
private const int SW_HIDE = 0;//隱藏
private const int SW_SHOW = 5;//顯示
使用
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE); //隱藏任務欄
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_SHOW); //顯示任務欄