问题与WindowStyle和ProcessStartInfo

本文关键字:ProcessStartInfo WindowStyle 问题 | 更新日期: 2023-09-27 18:04:27

我现在正在使用这个代码:

ProcessStartInfo startInfo = new ProcessStartInfo();
Process process = new Process();
private void button1_Click(object sender, EventArgs e) {
    startInfo.FileName = @"D:'קוד C#'WindowsFormsApplication11'WindowsFormsApplication11'obj'x86'Debug'WindowsFormsApplication11.exe";
   // startInfo.Arguments = "-console -game cstrike +map de_dust +maxplayers 16 -port 27017";
    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
    process.StartInfo = startInfo; 
    process.Start();
}
private void button2_Click(object sender, EventArgs e) {
    startInfo.WindowStyle = ProcessWindowStyle.Maximized;
}

代码实际上工作得很好,但问题是:

当我启动程序时(通过单击button1),程序运行为"隐藏"(如我所愿)。但我怎么能改变它不在hidden模式?

另一个问题:

如果程序不能进入hidden模式怎么办?那我该怎么办呢?

问题与WindowStyle和ProcessStartInfo

通常的方法是通过在系统托盘图标。一旦你的程序被隐藏,你使系统托盘图标可用,并把再次显示窗口的动作放在托盘图标的上下文菜单中。

相关文章:
  • 没有找到相关文章