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

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
Jina AI
Jina AI
雷峰网
雷峰网
月光博客
月光博客
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
美团技术团队
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
A
Arctic Wolf
Latest news
Latest news
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
F
Fortinet All Blogs
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
S
Secure Thoughts
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
V
Visual Studio Blog
P
Proofpoint News Feed
博客园 - 【当耐特】
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
H
Help Net Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tenable Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog

博客园 - 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