1回顶部 这几天不知道做什么, 受朋友影响, 看完了"新天龙八部", 深受感动, 所以打算做点好事. =) .NET框架被设计为禁止内存共享的, 但是好在FCL依然提供了一些类, 使得我们还是可以使用管道技术. 2回顶部 [代码] using System; using System.Diagnostics; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Threading; using System.Windows.Forms; namespace Sunmast.Sample.Pipe private System.Windows.Forms.RichTextBox tbResult; private System.ComponentModel.Container components = null; public Sample() private void Run() 3回顶部 // 这里是关键点,不用Shell启动/重定向输入/重定向输出/不显示窗口 p.Start(); tbResult.Text = s.Replace("\r","").Replace("\n","\r\n"); protected override void Dispose( bool disposing ) [STAThread] 4回顶部 #region Windows 窗体设计器生成的代码 5回顶部 this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnExit.Location = new System.Drawing.Point(320, 440); this.btnExit.Name = "btnExit"; this.btnExit.Size = new System.Drawing.Size(64, 24); this.btnExit.TabIndex = 1; this.btnExit.Text = "Exit"; this.btnExit.Click += new System.EventHandler(this.btnExit_Click); // // btnRefresh // this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnRefresh.Location = new System.Drawing.Point(248, 440); this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Size = new System.Drawing.Size(64, 24); this.btnRefresh.TabIndex = 2; this.btnRefresh.Text = "Refresh"; this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); // // Sample // this.AcceptButton = this.btnRefresh; this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.CancelButton = this.btnExit; this.ClientSize = new System.Drawing.Size(392, 471); this.Controls.Add(this.btnRefresh); 6回顶部 this.Controls.Add(this.btnExit); this.Controls.Add(this.tbResult); this.Name = "Sample"; this.Text = "Sample"; this.ResumeLayout(false); } private void btnExit_Click(object sender, System.EventArgs e) private void btnRefresh_Click(object sender, System.EventArgs e) 怎么样, 很简单吧? 要是还不懂自己调试调试代码就明白啦. 我的BLOG: http://blog.sunmast.com/ |
正在阅读:在.NET程序中使用PIPE(管道技术)在.NET程序中使用PIPE(管道技术)
2004-02-14 09:34
出处:PConline
责任编辑:linjixiong