我在Windows窗体中调用控制台窗口时如何隐藏它? [英] How to hide the console window when i call it in windows forms?
本文介绍了我在Windows窗体中调用控制台窗口时如何隐藏它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是使用以下代码在Windows应用程序中调用了控制台应用程序.
Hi,
I just called a console application in my windows application using the following code.
Process.Start("C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2008\\Projects\\i3server1\\i3server1\\bin\\Debug\\i3server1.exe");
现在,我需要在Windows窗体中调用该控制台应用程序时将其隐藏.在按钮单击事件上是否有任何代码可编写?
谢谢
Now,i need to hide this console application when it called in the windows form.Is there any code to write on the button click event?
Thanks
推荐答案
使用Process.Start
和ProcessStartInfo
参数并设置WindowStyle
.
http://stackoverflow.com/questions/836427/how-to-run-ac-sharp-console-application-with-the-console-hidden [ http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/system.diagnostics. processwindowstyle.aspx [ ^ ]
UseProcess.Start
withProcessStartInfo
parameter and setWindowStyle
.
http://stackoverflow.com/questions/836427/how-to-run-a-c-sharp-console-application-with-the-console-hidden[^]
http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx[^]
http://msdn.microsoft.com/en-us/library/system.diagnostics.processwindowstyle.aspx[^]
使用ProcessStartInfo类:
Use the ProcessStartInfo class:
ProcessStartInfo psi = new ProcessStartInfo("C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2008\\Projects\\i3server1\\i3server1\\bin\\Debug\\i3server1.exe");
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
Process.Start(psi);
这篇关于我在Windows窗体中调用控制台窗口时如何隐藏它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文