简体   繁体   English

Winforms .net C#-外部程序

[英]winforms .net c# - external program

I have c# .net (winforms) program with button. 我有带按钮的C#.net(winforms)程序。 I also have another console program in c++ (it takes as argument text file and change it). 我在c ++中还有另一个控制台程序(它将文本文件作为参数并进行更改)。 I wand to something like that: I press button (in c# program is stored path to txt file), the C++ program is executed but user dont see it (i dont want open for example command line in new window). 我用类似的方式:按下按钮(在C#程序中存储了txt文件的路径),执行了C ++程序,但用户看不到它(我不想在新窗口中打开例如命令行)。 Is it possible to do something like that? 可以做这样的事情吗?

Maybe, you should have a look at the Process.Start() method: http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx 也许您应该看看Process.Start()方法: http : //msdn.microsoft.com/zh-cn/library/0w4h05yb.aspx

In the ProcessStartInfo you can pass to this method, you can specify that no window should be opened. ProcessStartInfo您可以传递给此方法,可以指定不应打开任何窗口。

Process.Start(new ProcessStartInfo(pathToExeFile)
{
    CreateNoWindow = true,
    UseShellExecute = false,
    // ...
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM