惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - Franky
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
雷峰网
雷峰网
T
Tor Project blog
博客园_首页
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
V
Vulnerabilities – Threatpost
Project Zero
Project Zero
J
Java Code Geeks
AWS News Blog
AWS News Blog
Security Latest
Security Latest
Spread Privacy
Spread Privacy
T
Threatpost
博客园 - 三生石上(FineUI控件)
I
Intezer
G
Google Developers Blog
Scott Helme
Scott Helme
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The Hacker News
The Hacker News
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
NISL@THU
NISL@THU
A
Arctic Wolf
F
Full Disclosure
P
Proofpoint News Feed
G
GRAHAM CLULEY
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
N
Netflix TechBlog - Medium
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threat Research - Cisco Blogs
B
Blog
IT之家
IT之家
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
Know Your Adversary
Know Your Adversary

博客园 - Gofficer

决战紫禁之巅 为学 C#网页自动登录和提交POST信息的多种方法 一个C#写的调用外部进程类 快速实现在Windows应用程序中支持拖拽的TreeView控件(C#) PPT转图片 开发人员,敢问路在何方? C# 实现注销、关机、重启电脑功能 ultraGrid 控件中,实现单元格内容换行显示 如何用一条sql取得第10到第20条的记录? 用Sandcastle一键生成CHM帮助文档 实现服务器端与客户端对话 C#中访问WEB页面 使用代理服务器 自定义Ping方法 HTTP请求和应答 Socket套接字实现服务器端连接 Socket套接字实现客户端连接 异常处理
启动和停止本地系统进程
Gofficer · 2007-08-24 · via 博客园 - Gofficer

  1using System;
  2using System.Drawing;
  3using System.Collections;
  4using System.ComponentModel;
  5using System.Windows.Forms;
  6using System.Data;
  7// 添加新的命名空间。
  8using System.Text;
  9using System.Diagnostics;
 10using Microsoft.Win32;
 11
 12namespace StartMSWordApp
 13{
 14    /// <summary>
 15    /// 启动和停止本地系统进程。
 16    /// </summary>

 17    public class Form1 : System.Windows.Forms.Form
 18    {
 19        private System.Windows.Forms.Button button1;
 20        private System.Windows.Forms.RichTextBox richTextBox1;
 21        private System.Windows.Forms.TextBox textBox1;
 22        private System.Windows.Forms.Label label1;
 23        private System.Windows.Forms.Button button2;
 24        private System.Windows.Forms.OpenFileDialog openFileDialog1;
 25        /// <summary>
 26        /// 必需的设计器变量。
 27        /// </summary>

 28        private System.ComponentModel.Container components = null;
 29
 30        public Form1()
 31        {
 32            //
 33            // Windows 窗体设计器支持所必需的
 34            //
 35            InitializeComponent();
 36
 37            //
 38            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
 39            //
 40        }

 41
 42        /// <summary>
 43        /// 清理所有正在使用的资源。
 44        /// </summary>

 45        protected override void Dispose( bool disposing )
 46        {
 47            if( disposing )
 48            {
 49                if (components != null
 50                {
 51                    components.Dispose();
 52                }

 53            }

 54            base.Dispose( disposing );
 55        }

 56
 57        Windows Form Designer generated code
137
138        /// <summary>
139        /// 应用程序的主入口点。
140        /// </summary>

141        [STAThread]
142        static void Main() 
143        {
144            Application.Run(new Form1());
145        }

146        public Process myProcess;
147        private void button1_Click(object sender, System.EventArgs e)
148        {
149            try
150            {
151                if(textBox1.Text.Length != 0)
152                {
153                    myProcess = Process.Start(textBox1.Text);
154                    myProcess.WaitForExit();
155                }

156            }
 
157            catch (Exception ee) 
158            
159                richTextBox1.Text += "异常:"+ee.ToString()+"\n";
160            }
 
161        }

162
163        private void button2_Click(object sender, System.EventArgs e)
164        {
165            if(openFileDialog1.ShowDialog() == DialogResult.OK)
166            {
167                textBox1.Text = openFileDialog1.FileName;
168            }

169        }
 
170    }

171}

172