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;
        }
    }

  

posted @ 2014-05-28 17:51  Infly  阅读(155)  评论(0编辑  收藏  举报