c# – 在Windows 8中隐藏任务栏
发布时间:2020-12-15 17:46:37 所属栏目:百科 来源:网络整理
导读:到目前为止,我能够使用以下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);priva
到目前为止,我能够使用以下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时,此代码仅隐藏主监视器上的任务栏,而不是第二个,任务栏也可见. 如何才能在我的窗口显示的屏幕上隐藏任务栏? 解决方法
使用
FindWindowEx.这允许您传入一个窗口以便在Z顺序中搜索.
人机工程学: 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); 如果您只想在特定屏幕上隐藏任务栏,请使用GetWindowRect并检查窗口所在屏幕的界限,并仅在当前屏幕上的窗口上调用ShowWindow. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |