Nabízím moje "simple" řešení pro Windows.
Testováno jen na Windows7, ale asi funguje i ve všech vyšších.
Spouští se soubor taskbar.exe.
Takže taskbar hide -> skryje panel
nebo
taskbar show -> zobrazí panel
Aplikačka ke stažení.
Zde je celý zdroják:
using System;
using System.Runtime.InteropServices;
public 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 Main()
{
String[] arguments = Environment.GetCommandLineArgs();
Console.WriteLine("Type: \"taskbar show\" To show taskbar ");
Console.WriteLine("Type: \"taskbar hide\" To hide taskbar ");
if (arguments.Length != 2)
return;
if(arguments[1] == "show")
{
Console.WriteLine("Showing taskbar... ");
Show();
}
if(arguments[1] == "hide")
{
Console.WriteLine("Hidding taskbar... ");
Hide();
}
}
private Taskbar()
{
// hide ctor
}
public static void Show()
{
ShowWindow(Handle, SW_SHOW);
ShowWindow(HandleOfStartButton, SW_SHOW);
}
public static void Hide()
{
ShowWindow(Handle, SW_HIDE);
ShowWindow(HandleOfStartButton, SW_HIDE);
}
}
Kolik platíte