private const int SWP_HIDEWINDOW = 0x80;
private const int SWP_SHOWWINDOW = 0x40;
[DllImport("user32", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, int flags);
[DllImport("User32.dll")]
public static extern IntPtr FindWindowEx(IntPtr ph, IntPtr ch, String cn, String wn);
[DllImport("User32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, long nCmdShow );
private static void HideTaskWindow(bool bHide)
{
if (bHide)
{
IntPtr handle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
//ShowWindow(handle, 0);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0,SWP_HIDEWINDOW);
}
else
{
IntPtr handle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
//ShowWindow(handle, 5);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SWP_SHOWWINDOW);
}
}