Hide Taskbar in Windows 8

Don't hide the taskbar; that's the wrong way to do something like this. Instead, just make a fullscreen window, and the taskbar is smart enough to get out of your way.

You can read a good explanation & commentary by Microsoft's Raymond Chen on his blog.


Make use of FindWindowEx. This allows you to pass in a window to search after in the Z order as well.

Ergo:

DllImport("user32.dll")]
private static extern int FindWindowEx(int parent, int afterWindow, string className, string windowText);

// Start with the first child, then continue with windows of the same class after it
int hWnd = 0;
while (hWnd = FindWindowEx(0, hWnd, "Shell_TrayWnd", ""))
    ShowWindow(hWnd, SW_SHOW);

If you want to hide the task bar on a specific screen only, use GetWindowRect and check the bounds for what screen the window is on, and only call ShowWindow on the window that is on the current screen.

Tags:

C#