Hide taskbar in Windows 8

So far, I could 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 hides the taskbar on the main monitor, and not on the second one, where the taskbar is also visible.

How to hide the taskbar only on the screen where my windows are displayed?

+6
source share
3 answers

Use FindWindowEx . This also allows you to go to the search box in order Z.

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 taskbar only on a specific screen, use GetWindowRect and check the borders for the screen the window is on, and only ShowWindow is called in the window that is on the current screen.

+4
source

Do not hide the taskbar; what a wrong way to do something like that. Instead, just create a full-screen window and the taskbar is smart enough to get out of your way.

You can read a good explanation and comment by Microsoft Raymond Chen on his blog .

+9
source

I have the same problem.

1) Running the application on multiple monitors

2) There are no problems on the first monitor, the application remains at the top

3), but if you click the second window, the taskbar appears and vice versa

With FindWindowEx, only one Shell_TrayWnd file was found. its one of the first screen that can be hidden

0
source

Source: https://habr.com/ru/post/951815/


All Articles