Hide Taskbar in Windows 8
c#
Solution
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.
Problem
Up to now, I was able to use the following C# code to hide the Windows 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); private const int SW_HIDE = 0; private const int SW_SHOW = 1; ... int hwnd = FindWindow("Shell_TrayWnd", ""); ShowWindow(hwnd, SW_SHOW); ``` But when using Windows 8, this code only hides the taskbar on the primary monitor, not on the second, where the taskbar is also visible. How may I hide the taskbar only on the screen where my windows are being shown?