StrictThemes

Taskbar

using System; using System.Runtime.InteropServices; public static class Taskbar { [DllImport("user32.dll")] private static extern int FindWindow(string className, string windowText); [DllImport("user32.dll")] private static extern int ShowWindow(int hwnd, int command); [DllImport("user32.dll")] public static extern int FindWindowEx(int parentHandle, int childAfter, string className, int windowTitle); [DllImport("user32.dll")] private static extern int GetDesktopWindow(); private const int SW_HIDE = 0; private const int SW_SHOW = 1; protected static int Handle { get { return FindWindow("Shell_TrayWnd", ""); } } protected static int HandleOfStartButton { get { int handleOfDesktop = GetDesktopWindow(); int handleOfStartButton = FindWindowEx(handleOfDesktop, 0, "button", 0); return handleOfStartButton; } } public static void Show() { ShowWindow(Handle, SW_SHOW); ShowWindow(HandleOfStartButton, SW_SHOW); } public static void Hide() { ShowWindow(Handle, SW_HIDE); ShowWindow(HandleOfStartButton, SW_HIDE); } }
A simple C# code snippet that allows you to Show and Hide the Windows Taskbar by simply typing Taskbar.Hide(); or Taskbar.Show();

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.