using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 进程
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process.Start("clac");//Process 需要引用。 打开进程计算器 进程要求的名字是注册表里的名字
Process.Start("iexplore", "http://www.baidu.com");
}
private void button2_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "应用程序|*.exe";//打开文件对话框
DialogResult dr= openFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
}
}
private void button3_Click(object sender, EventArgs e)
{
Process p = new Process();
ProcessStartInfo s = new ProcessStartInfo(textBox1.Text);
p.StartInfo = s;//要打开的文件对象
p.Start();//打开的方法,不需要参数。
}
}
}