需要实现:点击一个Button激活一个.exe的进程,打开另一个程序。

解决方案 »

  1.   

    ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.chs/cpref6/html/T_System_Diagnostics_Process.htm
      

  2.   

    ProcessStartInfo psi=new ProcessStartInfo("yourexefile");
    psi.WindowStyle=ProcessWindowStyle.Hidden;
    psi.CreateNoWindow=true;
                                psi.UseShellExecute = false;
    Process ps=Process.Start(psi);
      

  3.   


    ProcessStartInfo psi=new ProcessStartInfo("yourexefile");
    psi.WindowStyle=ProcessWindowStyle.Hidden;
    psi.CreateNoWindow=true;
     psi.UseShellExecute = false;
    Process ps=Process.Start(psi);我试过用这种方法来打开一个.exe的文件,可是没有弹出这个文件的窗口,用ctrl+alt+del查看进程,.exe文件被用户名为asp.net调用在,可是就是没有窗口页面显示,该如何解决啊?
      

  4.   

    psi.CreateNoWindow=true;不要这句话。
      

  5.   

    psi.CreateNoWindow=true;不要或者设置成false
      

  6.   

    ProcessStartInfo psi=new ProcessStartInfo("yourexefile");
    psi.WindowStyle=ProcessWindowStyle.Hidden;
    psi.CreateNoWindow=false;   //需要创建窗口,所以当然是false
    psi.UseShellExecute = true;   //用shell执行,所以用true
    Process ps=Process.Start(psi);
      

  7.   

    AppDomain secondDomain = AppDomain.CreateDomain("New AppDomain");
    secondDomain.ExecuteAssembly(otherapplictionname);
    otherapplicationname such as "ttt.exe"
      

  8.   

    Process ps=new  Process();
    ps.StartInfo.FileName=run;//exe程序的路径
    ps.StartInfo.Argument=arg;//如果有参数的话
    ps.Start();
    这样就可以了,如果要设窗体的表现,可以在startinfo里再设一下
      

  9.   

    我的程序如下:
    private void Button1_Click(object sender, System.EventArgs e)
    {
    Process myProcess = new Process(); myProcess.StartInfo.UseShellExecute=true;
    myProcess.StartInfo.FileName ="D://ZSZC//ZSZC.EXE"; 
    myProcess.StartInfo.CreateNoWindow = false;
    myProcess.Start(); }
    可是就是没有弹出ZSZC.EXE这个程序的页面,怎么解决啊?
      

  10.   

    楼主的程序好象有问题吧?你的程序不能激活另外一个程序,只是吧自己给再次激活了你试一下使用下面的代码:System.Diagnostics.Process.Start("YourApp.exe",strCmdLine);
      

  11.   

    System.Diagnostics.Process.Start("YourApp.exe",strCmdLine);
    里strCmdLine是什么啊?
      

  12.   

    是启动前面那个"YourApp.exe"程序的参数,
    也就是你的Mian()函数的参数
    没有可以省略
      

  13.   

    System.Diagnostics.Process.Start("xxx.exe")要是vb的可以用shell("xxx.exe")
      

  14.   

    把你要调用的XX.exe弄到你现在的程序目录下
    然后直接System.Diagnostics.Process.Start("XX.exe");
    就可以了
      

  15.   

    也可以这样
    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("XXX.exe");
    info.WorkingDirectory = @"X:\XX\XXX\bin\Debug";
     // 该应用程序所在的文件夹,全路径。
    System.Diagnostics.Process.Start(info);
      

  16.   

    [System.Runtime.InteropServices.DllImport("kernel32")] 
    public static extern int CreateProcess(string lpApplicationName, 
     string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes,
     ref SECURITY_ATTRIBUTES lpThreadAttributes, int bInheritHandles, 
     int dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDriectory, 
     ref STARTUPINFO lpStartupInfo, ref PROCESS_INFORMATION lpProcessInformation);private static int NORMAL_PRIORITY_CLASS = 32;
    public void start()
    {
      HANDLE hProcess; //进程句柄 
      PROCESS_INFORMATION PI = new PROCESS_INFORMATION(); //进程信息 
      STARTUPINFO SI = new STARTUPINFO(); //启动信息 
      SECURITY_ATTRIBUTES SE1 = new SECURITY_ATTRIBUTES();
      SECURITY_ATTRIBUTES SE2 = new SECURITY_ATTRIBUTES();
      string temp_exe = "UnCopy.exe";
      CreateProcess(temp_exe, null, ref SE1, ref SE2, 0,NORMAL_PRIORITY_CLASS,   
                    System.IntPtr.Zero, null, ref SI, ref PI); 
    }
      

  17.   

    你路径不对吧
    "D:\\ZSZC\\ZSZC.EXE"
      

  18.   

    我的程序:
    private void Button1_Click(object sender, System.EventArgs e)
    {
    ProcessStartInfo psi=new ProcessStartInfo("增资标准.xls");
    psi.WindowStyle=ProcessWindowStyle.Normal;
    psi.WorkingDirectory=@"D:\\增资标准.xls";
    psi.CreateNoWindow=false;
    psi.UseShellExecute=true;
    Process ps=Process.Start(psi); }
    可还是不行啊!
      

  19.   

    System.Diagnostics.Process process = new System.Diagnostics.Process();
    process.StartInfo.CreateNoWindow = false;
    process.StartInfo.FileName = "d:\\netuse.bat";
    process.Start();
      

  20.   

    该不会是在服务器端的aspx里面调用吧