我似乎无法在Google或StackOverflow上find答案。
如何在后台启动进程(在活动窗口后面)? 就像当进程启动时,它不会中断用户正在使用的当前应用程序。
这个过程不会在当前应用程序的前面popup,它只会启动。
这就是我正在使用的:
C#.NET应用程序在64位环境中运行时抛出ODBC驱动程序不匹配错误
使用InstallShield LE 2015安装或激活.NET 3.5 Windows XP – 10
可靠地检测到我的另一个应用程序正在运行
什么操作系统内置的.NET 2版本?
Process.Start(Chrome.exe);
Chrome在启动时会在我的应用程序前popup。 我怎样才能让它在后台启动?
我也试过:
psi = new processstartinfo ("Chrome.exe"); psi.UseShellExecute = true; psi.WindowStyle = ProcessWindowStyle.Hidden; psi.WindowStyle = ProcessWindowStyle.Minimized; Process.Start(psi);
但是从前一个没什么区别。
谢谢。
如何在.NET应用程序中正确实现“以pipe理员身份”或“以pipe理员身份运行”选定的操作?
C#帮助 – FileSystemWatcher类
默认的ScrollingOffset鼠标滚轮更改
.NET和本机C ++应用程序之间进行通信的最佳方式
C# – 从现有stream程中读取文本
尝试这个:
Process p = new Process(); p.StartInfo = new processstartinfo("Chrome.exe"); p.StartInfo.WorkingDirectory = @"C:Program FilesChrome"; p.StartInfo.CreateNowindow = true; p.Start();
另外,如果这不起作用,请尝试添加
p.StartInfo.UseShellExecute = false;
下面的代码应该做你需要的:
class Program { static void Main(string[] args) { var handle = Process.GetCurrentProcess().MainWindowHandle; Process.Start("Chrome.exe").WaitForInputIdle(); SetForegroundWindow(handle.ToInt32()); Console.ReadLine(); } [DllImport("User32.dll")] public static extern Int32 SetForegroundWindow(int hWnd); }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。