标题:求帮助 不知道怎么改
只看楼主
晓小晓小
Rank: 2
等 级:论坛游民
帖 子:12
专家分:38
注 册:2014-5-15
结帖率:66.67%
已结贴  问题点数:20 回复次数:2 
求帮助 不知道怎么改
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace _6._2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            Process[] allProcess = Process.GetProcesses();
            foreach(Process  myProcess in allProcess ){
            listBox1.Items.Add("进程: " + myProcess.ProcessName + "的ID为:" + Convert.ToString(myProcess.Id ));
            
            }
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Process myprocess = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo(Application.StartupPath+"\\NOTEPAD.exe");
            startInfo.WindowStyle = ProcessWindowStyle.Normal;
            startInfo.WorkingDirectory = Application.StartupPath;
            myprocess.StartInfo = startInfo;
            myprocess.StartInfo.UseShellExecute = false;
            myprocess.Start();
            Process current = Process.GetCurrentProcess();
            current.CloseMainWindow();


        }
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("真的要退出系统吗?", "进程测试程序",
                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                e.Cancle = false;
            else
                e.Cancle = true;
        
        }
    }
}
搜索更多相关主题的帖子: private public 
2015-04-25 17:37
Libing_
Rank: 2
等 级:论坛游民
威 望:1
帖 子:18
专家分:31
注 册:2015-4-26
得分:20 
这是  CS 下的代码,你想改啥?
2015-04-26 18:42
hellation
Rank: 2
等 级:论坛游民
帖 子:38
专家分:56
注 册:2015-4-11
得分:0 
同问
2015-05-06 20:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-444484-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.713797 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved