通过vc6打开.c文件:
Process.Start("work1.c",C:/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin/MSDEV.EXE);
以上这个方法在windows应用程序上已经能够实现了。
现在,我做的是网站系统,想通过网页的形式来调用  vc6程序来打开.c文件还望高手指点指点.......!

解决方案 »

  1.   

    请问:
    通过vc6打开.c文件: 
    Process.Start( "work1.c ",C:/Program   Files/Microsoft   Visual   Studio/COMMON/MSDev98/Bin/MSDEV.EXE); 
    以上这个方法在windows应用程序上已经能够实现了。 
    现在,我做的是网站系统,想通过网页的形式来调用     vc6程序来打开.c文件 
    还望高手指点指点.......!
    webservice是什么东西呢?
      

  2.   

    //如果调用系统自带程序,比如记事本可以这样
    System.Diagnostics.Process.Start("notepad.exe"); 
    你这个是调用算外部程序,所以给你如下代码参考:
     /// <summary>
    /// 运行外部程序
    /// </summary>
    /// <param name="exeName">程序路径</param>
    /// <returns>0:失败,1:成功</returns>
    public bool RunIt( string exeName )
    {
    //声明一个程序信息类
    System.Diagnostics.ProcessStartInfo  Info  =  new  System.Diagnostics.ProcessStartInfo();
    //设置外部程序名
    Info.FileName  = exeName;
    //声明一个程序类
    try
    {
    System.Diagnostics.Process  Proc  ;
    Proc  =  System.Diagnostics.Process.Start(Info);
    return true;
    }
    catch
    {
    return false;
    }
    }
    /// <summary>
    /// 判断是否运行
    /// </summary>
    /// <param name="exeName">程序名</param>
    /// <returns>0:没运行,1:运行中</returns>
    public bool IsRun( string exeName )
    {
    string isrunning = "0";
    Process[] myProcesses = Process.GetProcesses();
    foreach(Process myProcess in myProcesses)
    {if ( myProcess.ProcessName == exeName )
    {
    isrunning = "1";
    break;
    }
    }
    if ( isrunning == "1" )
    {
    return true;
    }
    else
    {
    return false;
    }

    /// <summary>
    /// 结束进程
    /// </summary>
    /// <param name="exeName">进程名</param>
    /// <returns>0:失败,1:成功</returns>
    public bool Kill( string exeName )
    {
    string isrunning = "0";
    Process[] myProcesses = Process.GetProcesses();
    foreach(Process myProcess in myProcesses)
    {if ( myProcess.ProcessName == exeName )
    {
    try
    {
    myProcess.Kill();
    isrunning = "1";
    }
    catch
    {
    isrunning = "0";
    }
    break;
    }
    }
    if ( isrunning == "1" )
    {
    return true;
    }
    else
    {
    return false;
    }
    }///////////////////////////////
    using System;
    using System.Diagnostics;
    namespace ZZ
    {
     /// <summary>
     /// CmdUtility 的摘要说明。
     /// </summary>
     public class CmdUtility
     {
      //private Process process;  /// <summary>
      /// 构造函数
      /// </summary>
      public CmdUtility()
      {
       //this.process = new Process();
      }
      /// <summary>
      /// 执行单条命令
      /// </summary>
      /// <param name="commandText">命令文本</param>
      /// <returns>命令输出文本</returns>
      public static string ExeCommand(string commandText)
      {
       Process p = new Process();
       p.StartInfo.FileName = "cmd.exe";
       p.StartInfo.UseShellExecute = false;
       p.StartInfo.RedirectStandardInput = true;
       p.StartInfo.RedirectStandardOutput = true;
       p.StartInfo.RedirectStandardError = true;
       p.StartInfo.CreateNoWindow = true;
       string strOutput = null;
       try
       {
        p.Start();
        p.StandardInput.WriteLine(commandText);
        p.StandardInput.WriteLine("exit");
        //string formats = s.Replace("\r","").Replace("\n","\r\n");
        strOutput = p.StandardOutput.ReadToEnd();
        p.WaitForExit();
        p.Close();
       }
       catch(Exception e)
       {
        strOutput = e.Message;
       }
       return strOutput;
      }
      /// <summary>
      /// 执行多条命令
      /// </summary>
      /// <param name="commandArray">命令文本数组</param>
      /// <returns>命令输出文本</returns>
      public static string ExeCommand(string [] commandTexts)
      {
       Process p = new Process();
       p.StartInfo.FileName = "cmd.exe";
       p.StartInfo.UseShellExecute = false;
       p.StartInfo.RedirectStandardInput = true;
       p.StartInfo.RedirectStandardOutput = true;
       p.StartInfo.RedirectStandardError = true;
       p.StartInfo.CreateNoWindow = true;
       string strOutput = null;
       try
       {
        p.Start();
        foreach(string item in commandTexts)
        {
         p.StandardInput.WriteLine(item);
        }
        p.StandardInput.WriteLine("exit");
        strOutput = p.StandardOutput.ReadToEnd();
        p.WaitForExit();
        p.Close();
       }
       catch(Exception e)
       {
        strOutput = e.Message;
       }
       return strOutput;
      }
      /// <summary>
      /// 启动外部应用程序
      /// </summary>
      /// <param name="appName">应用程序路径名称</param>
      /// <returns>true表示成功,false表示失败</returns>
      public static bool StartApp(string appName)
      {
       bool blnRst = false;
       Process p = new Process();
       p.StartInfo.FileName = appName;//exe,bat and so on
       p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
       try
       {
        p.Start();
        p.WaitForExit();
        p.Close();
        //while (!p.HasExited)
        //{
        // Thread.Sleep(1000);
        //}
        blnRst = true;
       }
       catch
       {
       }
       return blnRst;
      }
      /// <summary>
      /// 启动外部应用程序
      /// </summary>
      /// <param name="appName">应用程序路径名称</param>
      /// <param name="style">进程窗口模式</param>
      /// <returns>true表示成功,false表示失败</returns>
      public static bool StartApp(string appName,ProcessWindowStyle style)
      {
       bool blnRst = false;
       Process p = new Process();
       p.StartInfo.FileName = appName;//exe,bat and so on
       p.StartInfo.WindowStyle = style;
       try
       {
        p.Start();
        p.WaitForExit();
        p.Close();
        blnRst = true;
       }
       catch
       {
       }
       return blnRst;
      }
      /// <summary>
      /// 启动外部应用程序
      /// </summary>
      /// <param name="appName">应用程序路径名称</param>
      /// <param name="arguments">启动参数</param>
      /// <returns>true表示成功,false表示失败</returns>
      public static bool StartApp(string appName,string arguments)
      {
       bool blnRst = false;
       Process p = new Process();
       p.StartInfo.FileName = appName;//exe,bat and so on
       p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
       p.StartInfo.Arguments = arguments;
       try
       {
        p.Start();
        p.WaitForExit();
        p.Close();
        blnRst = true;
       }
       catch
       {
       }
       return blnRst;
      }
      /// <summary>
      /// 启动外部应用程序
      /// </summary>
      /// <param name="appName">应用程序路径名称</param>
      /// <param name="arguments">启动参数</param>
      /// <param name="style">进程窗口模式</param>
      /// <returns>true表示成功,false表示失败</returns>
      public static bool StartApp(string appName,string arguments,ProcessWindowStyle style)
      {
       bool blnRst = false;
       Process p = new Process();
       p.StartInfo.FileName = appName;//exe,bat and so on
       p.StartInfo.WindowStyle = style;
       p.StartInfo.Arguments = arguments;
       try
       {
        p.Start();
        p.WaitForExit();
        p.Close();
        blnRst = true;
       }
       catch
       {
       }
       return blnRst;
      }
             }

      

  3.   

    webservice是什么东西呢?
    这都不知道还搞WEB开发?
      

  4.   

    谢谢 patriot074真的非常感谢你问你一下,你给我的程序,我已经应运了。
    然后,我该怎么调用它呢?