日期:2014-05-18  浏览次数:20914 次

高手进来帮忙解决下,谢谢了先
想实现如下功能:
有主程序main.exe,有附程序lo.exe,lo.exe不允许直接运行,只能由main.exe调用运行。

不知道如何实现,不知道如何创建项目,是分别创建两个工程还是在一个工程里创建两个项目,打包的时候怎么弄,麻烦大哥帮忙详细介绍下。小弟先谢谢了。

------解决方案--------------------
C# code

   Process myProcess = new Process();
   myProcess.StartInfo.FileName =Application.StartupPath+"lo.exe";
   myProcess.Start();

------解决方案--------------------
lo.exe的main函数必须传入某个参数
main(string[] info)
{
if(info!=null)
{
if(info[0]=="aaa")//专用判断数据
//运行
}

return;//退出了

}

在main.exe处调用的时候

Process myProcess = new Process();
myProcess.StartInfo.FileName =Application.StartupPath+"lo.exe";
 myProcess.StartInfo.Arguments="aaa";//专用判断数据
myProcess.Start();


随便一写,不一定能运行。最好是翻看一下msdn关于process的说明。