到目前为止,我能够使用以下 C# 代码来隐藏 Windows 任务栏:
[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);
但是在使用 Windows 8 时,此代码仅在主监视器上隐藏任务栏,而不是在任务栏也可见的第二个监视器上。
如何仅在显示我的窗口的屏幕上隐藏任务栏?