首页 > 解决方案 > 需要使用 C# 中的代码从另一个应用程序以最小化模式打开 Windows 窗体应用程序

问题描述

需要使用 C# 中的代码从另一个应用程序以最小化模式打开 Windows 窗体应用程序

我正在使用以下代码以最小化模式打开 Windows 窗体应用程序。

System.Diagnostics.Process process = new System.Diagnostics.Process();
 process.StartInfo.Arguments = null;
 process.StartInfo.CreateNoWindow = true;
 process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
 process.StartInfo.FileName = fileName;
 process.StartInfo.UseShellExecute = true;
 process.Start();

但是我无法在应用程序启动时显示气球通知。我已经在表单构造函数中编写了通知气球代码。我的代码没有触发,因为我在最小化模式下打开应用程序并且时间表单没有在最大化模式或任务栏下打开。它将显示仅在 NotifyTray 图标中。因此,在这种情况下,用户可能无法识别我在后台启动的服务,所以我只想显示有关该服务的气球通知,而无需在正常或最大化模式下打开应用程序。

notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipText = "Service Started";
notifyIcon1.ShowBalloonTip(3000);

请让我们知道是否有任何地方或事件可以在申请开始时显示气球通知。

标签: c#winformssystem-tray

解决方案


推荐阅读