问题描述
我正在尝试开发基于表单的应用程序.通过单击一个菜单项,我有了homeform,它将打开另一个窗口.在该窗口中,最后一步是编译cpp文件,并通过关闭当前窗口来在homeform上并行地.
我正在将一组cpp源文件收集到一个列表中,并多次使用以下代码(基于文件数)进行编译.
i am trying to develop form based appl. in that i have homeform by clicking on one menu item it will open another window . in that window the last step is compilation of cpp files and paralelly by closing the current window.
i am collecting set of cpp sourcefiles to a list and using following code multiple times(based on number of files)for compile.
public void ExecuteCommandSync(string command)
{
// create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.
System.Diagnostics.ProcessStartInfo procStartInfo = new
System.Diagnostics.ProcessStartInfo("cmd", "/c" + command);
// The following commands are needed to redirect the standard output.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.RedirectStandardError = true;
procStartInfo.UseShellExecute = false;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();
string error = proc.StandardError.ReadToEnd();
}
我们正在尝试将上述代码中的错误"和结果"字符串写到list< string>中.并尝试在homeform上显示.但是当我们关闭当前窗口时,该列表< string>没有重定向到主页.并且我无法达到并行性(将编译和状态显示到主页).
上面的函数将被多次调用(基于选择用于编译的cpp文件的数量).
we are trying to write "error" and "result" strings in above code to a list<string> and trying to display on homeform . but when we close current window that list<string> is not redirecting to homepage.and i am unable to achive parallelism (compiling and status display to homepage).
above function will be called for multiple times (based on number of cpp files selected for compilation).
推荐答案
这篇关于工艺状态显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!