Cacher/Afficher la barre des tâches windows

Contenu du snippet

[DllImport("user32", EntryPoint = "FindWindowA")] 
public static extern int FindWindows(String lpClassName, String lpWindowsName);
[DllImport("user32")] 
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);


public const int TASKBAR_SHOW = 64; 
public const int TASKBAR_HIDE = 128;


public static void ShowBar() 
{
   int taskBarHandle = FindWindows("Shell_traywnd", String.Empty); 
   SetWindowPos(taskBarHandle, 0, 0, 0, 0, 0, TASKBAR_SHOW);
}

public static void HideBar() 
{
   int taskBarHandle = FindWindows("Shell_traywnd", String.Empty); 
   SetWindowPos(taskBarHandle, 0, 0, 0, 0, 0, TASKBAR_HIDE);
}


Compatibilité : C# 1.x, C# 2.x

Disponible dans d'autres langages :

A voir également