软件启动设计
软件主界面启动时首先要顺序调用外部的可执行文件如exe,控制台等程序等
暂时命名为1.exe,2.exe,3.exe...
然后把启动的信息现在在启动主程序的控制台上,比如1.exe是加载数据库,2.exe是加载配置文件等等
现在的问题是:
1.如何调用这些外部的程序?
2.调用这些外部程序后如何知道这些外部程序是否正确加载运行,并返回给启动主程序的控制台
显示调用的外部程序运行信息呢?
3.启动程序如何和调用的程序进行交互呢?
[解决办法]
Process
ProcessInfo
I/O Redirect
[解决办法]
I/O Redirect
[解决办法]
- C# code
public static string GetLocalCardAddress() { string mac = ""; System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = "ipconfig"; process.StartInfo.Arguments = "/all"; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.Start(); process.WaitForExit(); string output = process.StandardOutput.ReadToEnd(); int length = output.IndexOf("Physical Address. . . . . . . . . : "); if(length>0) { mac = output.Substring(length+36, 17); } return mac; }
[解决办法]
[解决办法]