zoukankan      html  css  js  c++  java
  • Process调用winform程序

    调用者:

           string path = @"../temp.exe";
                string Name = @"temp.xml";
                using (Process p = new Process())
                {
                    p.StartInfo.FileName = path;//可执行程序路径
                    p.StartInfo.Arguments = Name;//参数以空格分隔,如果某个参数为空,可以传入""
                    p.StartInfo.UseShellExecute = false;//是否使用操作系统shell启动
                    p.StartInfo.CreateNoWindow = true;//不显示程序窗口
                    p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
                    p.StartInfo.RedirectStandardInput = true;   //接受来自调用程序的输入信息
                    p.StartInfo.RedirectStandardError = true;   //重定向标准错误输出
                    p.Start();
                    Console.WriteLine(p.StandardOutput.ReadToEnd());  
                    p.WaitForExit();
                }

    被调用者:

    创建一个winform程序

    上面的 p.StartInfo.Arguments 传入的参数就在 Program.cs 中 Main 中的 args 参数

    这样取值:
    args[0] args[1] args[2] ..........

    想使用WebBrowser是要在Form中加载对象

  • 相关阅读:
    hdu 5475(打破固定思维OR线段树)
    hdu 2521 反素数(打表)
    hdu 4540(dp)
    hdu 4535(排列组合之错排公式)
    hdu 4530(数学)
    hdu 4528(搜索好题)
    hdu 4522(图论,构图)
    kalinux 换源
    用python进行wifi密码生成
    hashcat 中文文档
  • 原文地址:https://www.cnblogs.com/mi21/p/14097582.html
Copyright © 2011-2022 走看看