/// <summary> |
/// 启动其他的应用程序 |
/// </summary> |
/// <param name="file">应用程序名称</param> |
/// <param name="workdirectory">应用程序工作目录</param> |
/// <param name="args">命令行参数</param> |
/// <param name="style">窗口风格</param> |
public static bool StartProcess( string file, string workdirectory, string args,ProcessWindowStyle style) |
{ |
try |
{ |
Process myprocess = new Process(); |
ProcessStartInfo startInfo = new ProcessStartInfo(file,args); |
startInfo.WindowStyle = style; |
startInfo.WorkingDirectory = workdirectory; |
myprocess.StartInfo = startInfo; |
//myprocess.StartInfo.UseShellExecute = false; |
myprocess.Start(); |
return true ; |
} |
catch (Exception e0) |
{ |
MessageBox.Show( "启动应用程序时出错!原因:" + e0.Message); |
} |
return false ; |
} |