c# windowsForm 中调用c语言生成的exe文件问题时只能打开空的dos窗体,里面的内同显示不出来 为什么呢?
调用exe文件代码如下:
            Process p = new Process(); 
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = false;
            p.StartInfo.FileName = "cmd.exe";            p.Start();
            p.StandardInput.WriteLine("D:\\ModelBase\\MS.exe");
按照上述例子调用MS.exe显示的窗体是空的,为什么呢?

解决方案 »

  1.   

                p.StartInfo.UseShellExecute = false; 
                p.StartInfo.RedirectStandardInput = true; 
                p.StartInfo.RedirectStandardOutput = true; 
                p.StartInfo.RedirectStandardError = true; 
    -------------------------------------
    既然你有这样的疑问,肯定不知道这几条语句的作用是吧?去了,再看看结果。
      

  2.   

                Process p = new Process(); 
                p.StartInfo.CreateNoWindow = false;
                p.StartInfo.FileName = "D:\\ModelBase\\MS.exe";
                
                
                p.Start();
    这样写 ,窗口又会一闪而过,MS.exe是用C语言写的,其他exe文家都可以的啊
      

  3.   

                p.StartInfo.UseShellExecute = false; 
                p.StartInfo.RedirectStandardInput = true; 
    -----------------------------------
    保留这个看看。
      

  4.   

    试试
                Process p = new Process();
                p.StartInfo.UseShellExecute= true;
                p.StartInfo.FileName = "D:\\ModelBase\\MS.exe";