做一个Windows窗体版的DOS分析器
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;
using system.data;
using system.diagnostics;
namespace ezonedosapp
{
///
/// form1 的摘要说明。
///
public class form1 : system.windows.forms.form
{
private system.windows.forms.textbox txtcmd;
private system.windows.forms.button btnok;
private system.windows.forms.richtextbox rtbresult;
///
/// 必需的设计器变量。
///
private system.componentmodel.container components = null;
private process processcmdobject;
public form1()
{
//
// windows 窗体设计器支持所必需的
//
initializecomponent();
//
// todo: 在 initializecomponent 调用后添加任何构造函数代码
//
processcmdobject=new process();
processcmdobject.startinfo.filename="cmd.exe";
processcmdobject.startinfo.useshellexecute=false;
processcmdobject.startinfo.redirectstandardinput=true;
processcmdobject.startinfo.redirectstandardoutput=true;
processcmdobject.startinfo.redirectstandarderror=true;
processcmdobject.startinfo.createnowindow=true;
processcmdobject.start();
}
///
/// 清理所有正在使用的资源。
///
protected override void dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.dispose();
}
}
base.dispose( disposing );
}
#region windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void initializecomponent()
{
this.txtcmd = new system.windows.forms.textbox();
this.btnok = new system.windows.forms.button();
this.rtbresult = new system.windows.forms.richtextbox();
this.suspendlayout();
//
// txtcmd
//
this.txtcmd.location = new system.drawing.point(0, 0);
this.txtcmd.name = "txtcmd";
this.txtcmd.size = new system.drawing.size(448, 21);
this.txtcmd.tabindex = 0;
this.txtcmd.text = "";
//
// btnok
//
this.btnok.location = new system.drawing.point(456, 0);
this.btnok.name = "btnok";
this.btnok.tabindex = 1;
this.btnok.text = "确认";
this.btnok.click += new system.eventhandler(this.btnok_click);
//
// rtbresult
//
this.rtbresult.location = new system.drawing.point(0, 24);
this.rtbresult.name = "rtbresult";
this.rtbresult.size = new system.drawing.size(536, 424);
this.rtbresult.tabindex = 2;
this.rtbresult.text = "";
//
// form1
//
this.autoscalebasesize = new system.drawing.size(6, 14);
this.clientsize = new system.drawing.size(536, 445);
this.controls.add(this.rtbresult);
this.controls.add(this.btnok);
this.controls.add(this.txtcmd);
this.formborderstyle = system.windows.forms.formborderstyle.fixedsingle;
this.maximizebox = false;
this.name = "form1";
this.text = "dos分析器 - 亿众国际";
this.closing += new system.componentmodel.canceleventhandler(this.form1_closing);
this.resumelayout(false);
}
#endregion
///
/// 应用程序的主入口点。
///
[stathread]
static void main()
{
application.run(new form1());
}
private void btnok_click(object sender, system.eventargs e)
{
processcmdobject=new process();
processcmdobject.startinfo.filename="cmd.exe";
processcmdobject.startinfo.useshellexecute=false;
processcmdobject.startinfo.redirectstandardinput=true;
processcmdobject.startinfo.redirectstandardoutput=true;
processcmdobject.startinfo.redirectstandarderror=true;
processcmdobject.startinfo.createnowindow=true;
processcmdobject.start();
processcmdobject.standardinput.writeline(this.txtcmd.text.trim());
processcmdobject.standardinput.writeline("exit");
this.rtbresult.text=processcmdobject.standardoutput.readtoend()+processcmdobject.standarderror.readtoend();
}
private void form1_closing(object sender, system.componentmodel.canceleventargs e)
{
}
}
}
author: stardicky
e-mail: stardicky@hotmail.com
qqnumber: 9531511
companyname: ezone international
class: hbs-0308
title: 做一个windows窗体版的dos分析器
()
- · 个人Internet网站创建过程详解
- · 在C#中调用VBScript等脚本的实现(下)
- · 在C#中调用VBScript等脚本的实现(上)
- · 设计模式之代理模式(Proxy)
- · 如何给DataGrid添加双题头分类显示
- · ASP漏洞全接触-高级篇
- · 轻松玩转弹出窗口
- · ASP漏洞全接触-入门篇
- · IIS服务器组建攻略
- · 其实做小偷是很容易的
- · XMLHTTP下载远程数据输出到浏览器
- · Jave基础学习:jdbc小技巧
- · 一棵php的类树(支持无限分类)
- · 用asp.net 实现九连环小游戏
- · MySQL数据导入导出方法与工具介绍(1)
- · 轻松弹出无边框网页的Javscrpt代码
- · ASP初学者参考
- · Java新手学习:IIS6和Tomcat5的整合
- · asp常用函数
- · W3 Jmail中文使用说明
- · 无组件上传图片到数据库中,最完整解决方案
- · 二级域名原理以及程序,申请即可开通
- · Java学习过程的一些重点
- · Oracle9i中如何建立不同字符集的数据库
- · 修复SQL Server 2000数据库之实战经验
- · 使用ASP生成HTML文件
- · 编写安全的ASP代码
- · 十天学会ASP.net(2)
- · 十天学会ASP.net(1)
- · 十天学会php(2)
- · 十天学会php(1)
- · 三天学好ADO
- · 在数据库中存取文件
- · 解决大字段在Form中Post出错的方法
- · 利用ASP+JMAIL进行邮件群发的新思路
- · 关于处理GET方式提交的含有特殊字符的参数
- · 关于Adodb.Stream 的使用说明
- · 多文件多文本框上传程序
