防止进程在启动期间显示窗口
我正在使用 Process 类从 WPF 应用程序启动一个应用程序,该类在启动时显示启动屏幕。我不想向用户显示启动屏幕,而是希望通过将窗口保持在最上面并最大化来隐藏应用程序启动后的前几秒钟。问题是启动此应用程序会自动使我的窗口脱离最顶层模式并显示 Windows 任务栏。有没有办法阻止进程在启动之前显示窗口几秒钟,然后显示其窗口?
I'm launching an application from a WPF app using the Process class that displays a splash screen at startup. Rather than show the user the splash screen, I'd like to hide the application for the first couple of seconds after starting it by keeping my window topmost and maximized. The problem is that starting this application automatically takes my window out of topmost mode and shows the windows task bar. Is there a way to prevent the process from showing a window for a few second until it starts up, then displaying its window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因此,您有两个应用程序争夺最顶层窗口,但当然只有一个应用程序可以同时成为最顶层。 Windows 理所当然地不会让单个应用程序做出这样的决定,这将是一个安全漏洞。请参阅 Raymond Chen 的回答,原因如下: http://blogs.msdn .com/oldnewthing/archive/2005/06/07/426294.aspx
So you have two application fighting about being top most window but of course only one can be top most at the same time. Windows rightfully don't let a single application make that decision, that would be a security hole. See Raymond Chen's answer here why: http://blogs.msdn.com/oldnewthing/archive/2005/06/07/426294.aspx
您是否拥有您尝试启动的应用程序,但在启动时没有直接显示其主窗口?在这种情况下,请执行以下操作。
重写 App 类中的 Application.OnStartup 方法并在那里进行初始化。在该方法完成之前,不会(自动)显示任何窗口或任务栏按钮。
Do you own the application you are trying to start without showing it's main window directly at startup? In that case do the following.
Override the Application.OnStartup method in your App class and do your initialization there. No windows or taskbar buttons will be displayed (automatically) until after that method finishes.
难道您不能将启动时的主窗口的可见性设置为“折叠”,然后在启动画面启动后切换它吗?
Can't you just set the visibility of the MainWindow that starts up to Collapsed and then toggle it after the splash launches?