如何用C#打开本地程序 用VS2005编程

来源:百度知道 编辑:UC知道 时间:2024/06/29 20:59:23
比如我想打开D盘里某个EXE文件 用VS2005

EXE文件不用能VS打开的吧,只能是程序源码

同意楼上的,exe文件是可执行文件,内容都是二进制的机器码,是不能被直接VS2005修改的。
如果你想修改这个程序需要有该文件的源代码,这个源代码是制作这个程序的程序员编写的,可能是用C#编的也可能不是。
如果是用C#编的你应该找到这个程序的源文件(.cs后缀),如果用VS2005编辑还需要有他的工程文件(.dsp后缀),还有应该有相应的头文件(.h后缀)。

用这个试试吧,只是列子

Process info = new Process();
info.StartInfo.FileName = @"c:\Windows\System32\cmd.exe";
info.StartInfo.WorkingDirectory = @"C:\";
info.StartInfo.UseShellExecute = false;
info.StartInfo.RedirectStandardInput = true; //重定向标准输入
info.StartInfo.RedirectStandardOutput = true; //重定向标准输出
info.StartInfo.RedirectStandardError = true; //重定向错误输出
info.StartInfo.CreateNoWindow = false;
info.Start();

info.StandardInput.WriteLine("ping 127.0.0.1 -t");

}
info.StandardInput.WriteLine("Exit");
info.Close();
}

代码就不写了
用opendialog获取文件路径
用processer.start打开程序

using System;
using System.Dr