Process类

  提供对本地和远程进程的访问并使您能够启动和停止本地系统进程。

public partial class MainWindow : Window
    {
        Process myProcess = new Process();
        public MainWindow()
        {
            InitializeComponent();          
        }

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myProcess = new Process();
                myProcess.StartInfo.UseShellExecute = false;
                myProcess.StartInfo.FileName = "WaitPanel.exe";
                myProcess.StartInfo.CreateNoWindow = true;
                myProcess.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void btnStop_Click(object sender, RoutedEventArgs e)
        {
            myProcess.Kill();
            myProcess = null;
        }
    }

  

原文地址:https://www.cnblogs.com/infly123/p/3757605.html