永久隐藏或将任务栏移出屏幕Windows 10 LTSB ENT
我们需要隐藏任务栏并开始菜单。我们有一个运行全屏的应用程序,这是一个触摸屏应用程序。我们的触摸屏应用程序始终在屏幕上为99.9999%,覆盖整个屏幕。但是,这是一个复杂的多媒体应用程序,在极少数情况下,我们发现它崩溃了,暴露了桌面。我们有一个自定义的Win10 LTSB Ent构建,它是强大且合适的,但是我们希望进一步迈出一步。我们希望完全从桌面上删除任务栏(“隐藏”)。
我们可以使用下面的代码隐藏任务栏,但是它在5秒后返回。在没有我们做任何事情的情况下,某些事情不断消除我们的“隐藏”并恢复任务栏。
我做错了吗?我需要调整Windows OS中的服务或机制吗?
private static void setTaskBar(bool hide)
{
IntPtr window = Program.FindWindow("Shell_traywnd", "");
if (hide)
Program.SetWindowPos(window, IntPtr.Zero, 0, 0, 0, 0, 128U);
else
Program.SetWindowPos(window, IntPtr.Zero, 0, 0, 0, 0, 64U);
[DllImport("user32", SetLastError = true)]
private static extern IntPtr FindWindowEx(
IntPtr hWndl,
IntPtr hWnd2,
string lpsz1,
string lpsz2);
}
[DllImport("user32")]
private static extern bool SetWindowPos(
IntPtr hWndl,
IntPtr hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
uint uFlags);
We need to hide the taskbar and start menu. We have an app that runs full screen, it is a touch screen application. Our touch screen application is 99.9999% always on screen, covering the entire screen. It is however a complex multimedia app and on rare occasions we have found it crashed exposing the desktop. We have a custom made Win10 LTSB ENT build which is robust and appropriate, but we want to go a step further. We want to remove the taskbar (which is 'hidden') from the desktop entirely.
We can hide the taskbar using the code below, but it keeps returning 5 seconds later. Something keeps undoing our 'hide' and restoring the taskbar without us doing anything.
Am I doing something wrong? Is there a service or mechanism in Windows OS I need to adjust?
private static void setTaskBar(bool hide)
{
IntPtr window = Program.FindWindow("Shell_traywnd", "");
if (hide)
Program.SetWindowPos(window, IntPtr.Zero, 0, 0, 0, 0, 128U);
else
Program.SetWindowPos(window, IntPtr.Zero, 0, 0, 0, 0, 64U);
[DllImport("user32", SetLastError = true)]
private static extern IntPtr FindWindowEx(
IntPtr hWndl,
IntPtr hWnd2,
string lpsz1,
string lpsz2);
}
[DllImport("user32")]
private static extern bool SetWindowPos(
IntPtr hWndl,
IntPtr hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
uint uFlags);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
任务栏有些特别,当其他窗口进入全屏等,并相应地调整自身时,它会从窗口管理器接收消息。
与外壳混乱是错误的解决方案。一个更好的解决方案是启动程序的另一个实例,该实例只有一个完整的屏幕窗口,除了等待真实实例崩溃,然后在需要时重新启动外,什么也没做。
The taskbar is somewhat special, it receives messages from the window manager when other windows go in and out of fullscreen etc and adjusts itself accordingly.
Messing with the shell is the wrong solution. A better solution would be to launch another instance of your program that only has a fullscreen window and does nothing but waiting for the real instance to crash and then restart it if desired.