| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 578 人关注过本帖
标题:求帮助 不知道怎么改
取消只看楼主 加入收藏
晓小晓小
Rank: 2
等 级:论坛游民
帖 子:12
专家分:38
注 册:2014-5-15
结帖率:66.67%
收藏
已结贴  问题点数:20 回复次数:0 
求帮助 不知道怎么改
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
快速回复:求帮助 不知道怎么改
数据加载中...
 
   



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

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