Beispiel #1
0
        public static int StartProcess(string proName, string args)
        {
            Process p = new Process();
            //声明一个程序信息类
            ProcessStartInfo Info       = new System.Diagnostics.ProcessStartInfo(proName, args.Trim());
            string           strWorkDir = proName.Substring(0, proName.LastIndexOf("\\") + 1);

            Info.WorkingDirectory = strWorkDir;
            try
            {
                p = Process.Start(Info);
            }
            catch (System.ComponentModel.Win32Exception e)
            {
                //CommonClass.ShowTip("程序路径出错");
                FileRW.WriteError(string.Format("系统找不到指定的程序文件:{0}", e.ToString()));
                return(0);
            }
            return(p.Id);
        }