zoukankan      html  css  js  c++  java
  • C# Process 进程管理

    1、获取当前系统正在运行的进程

                //获取当前系所有正在运行的进程
                Process[] proc = Process.GetProcesses();
                foreach (Process var in proc)
                {
                    textBox1.Text += var+"
    ";
                    //var.Kill();  杀死本进程
                }

    2、进程打开应用程序

    private void button2_Click(object sender, EventArgs e)
            {
                //进程打开应用程序  
                 Process.Start("notepad");
                //文件默认程序 打开文件
                 Process.Start(@"C:UsersDellDesktop	p.jpg");
                //进程打开文件
                 Process proc = new Process();
                 //proc.StartInfo.FileName=@"C:UsersDellDesktopSQLAnalyse.exe";
                 //proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                 //proc.Start();
    
                 proc.StartInfo.FileName = @"F:学习实例设置启动参数设置启动参数inDebug设置启动参数.exe";
                 //设置启动时窗体状体
                 //proc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; 
                 //proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                 //打开进程且窗体隐藏
                 //proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 //启动参数
                 proc.StartInfo.Arguments = "2";
                 proc.Start();
    
            }

    设置程序启动参数

      static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main(string[] age)
            {
    
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                int f = age.Length;
                if (age[0] == "1")
                {
                    Form1 from = new Form1();
                    from.Text = "页面"+age[0];
                    Application.Run(from);
                }
                if (age[0] == "2")
                {
                    Form1 from = new Form1();
                    from.Text = "页面"+age[0];
                    Application.Run(from);
                }
                
               
            }
        }
  • 相关阅读:
    Codeforces Round #573 (Div. 2) C. Tokitsukaze and Discard Items
    Codeforces Round #573 (Div. 2) B
    练习2
    练习1
    上机练习4
    上机练习3
    上机练习1
    JAVA第一次作业
    es document的强制替换、创建、删除
    es 返回定制化的_source数据
  • 原文地址:https://www.cnblogs.com/apimeng/p/9553448.html
Copyright © 2011-2022 走看看