A Class To Hide Show Task Bar (Works with XP)

1:46 AM
using System;
using System.Runtime.InteropServices;


 /// 
 /// This class will show or hide windows taskbar for full screen mode.
 /// 
 internal class HandleTaskBar
 {
  private const int SWP_HIDEWINDOW = 0x0080;
  private const int SWP_SHOWWINDOW = 0x0040;

        /// 
        /// Default Constructor.
        /// 
  public HandleTaskBar()
  {
  }

  [DllImport("User32.dll", EntryPoint="FindWindow")]
  private static extern int FindWindow(string lpClassName, string lpWindowName);

  [DllImport("User32.dll")]
  private static extern int SetWindowPos(int hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);

  /// 
  /// Show the TaskBar.
  /// 
  public static void showTaskBar()
  {
   int hWnd = FindWindow("Shell_TrayWnd", "");
   SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);
  }

  /// 
  /// Hide the TaskBar.
  /// 
  public static void hideTaskBar()
  {
   int hWnd = FindWindow("Shell_TrayWnd", "");
   SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
  }
 }


0 comments:

Post a Comment