ProcessStartInfo.WindowStyle C# [英] ProcessStartInfo.WindowStyle c#

查看:665
本文介绍了ProcessStartInfo.WindowStyle C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面开始我的应用程序之一

I use the following to start one of my applications

 // Start the process
 ProcessStartInfo startInfo = new ProcessStartInfo(this.exeName);

 startInfo.WindowStyle = ProcessWindowStyle.Minimized;

 controlProcess = System.Diagnostics.Process.Start(startInfo);

这是我看到的是行为,如果有在我的任务栏没有物品,上面的开始我的独立的应用程序,通过使用属性this.exeName来获取应用程序的路径,以及独立的应用程序被认为是在任务栏上。

The behavior that I see is that if there are no items in my task bar, the above starts my standalone application, by using the property this.exeName to get the path of the application, and the standalone application is seen on the task bar.

如果我的任务栏只有一个几个项目,上述情况不会发生,我单独的应用程序只知道当我在任务管理器,发现它是什么,我想,而不是场景在上面段描述。

If my taskbar has only a few items, the above situation does not happen and my stand alone application is only known when i find it in the task manager, which is what i want and not the scenario described in the above para.

从本质上讲,我想启动一个应用程序,并保持它不显示它的UI运行,更像是预加载应用程序,并在执行某些操作的用户点击,把应用集中并启用它,这样的用户可以执行的操作。

Essentially, I want to start an application and keep it running without displaying its UI, more like pre-load the application, and when user clicks on certain actions, bring the application to focus and enable it so that the user can perform actions

我的示例代码是从这里,看看这是我自己的实验项目。

My sample code is from here, to see if this is a feasible solution for my own experimental project

链接文本

推荐答案

您需要将ShowInTaskBar属性设置为false,你是启动应用程序的主要形式。此外,您将需要隐藏的形式,直到用户操作要求它显示出来。

You need to set the ShowInTaskbar property to false on the main form of the application that you are launching. Additionally, you will need to hide the form until a user action requests it to be shown.

您还可以添加一个NotifyIcon的系统盘,如果你想保持有些应用程序可见。

You can also add a notifyIcon to the system tray if you want to keep the application somewhat visible.

这篇关于ProcessStartInfo.WindowStyle C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆