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

软件启动设计
软件主界面启动时首先要顺序调用外部的可执行文件如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;
        }

------解决方案--------------------
探讨

C# code

public static string GetLocalCardAddress()
{
string mac = "";

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.Sta……

------解决方案--------------------
探讨

引用:
C# code


public static string GetLocalCardAddress()
{
string mac = "";

System.Diagnostics.Process process = new System.Diagnostics.Process();
proc……

这样也是指得到相关的信息而已,……