Process类

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 @   Infly  阅读(156)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示