2

我的任务是开发一个 Windows 应用程序,作为现有 C 应用程序的包装器。C 应用程序由命令行控制。我想知道是否可以将 WPF 用作此应用程序的 GUI?

4

1 回答 1

0

当您的应用程序是控制台应用程序时,请尝试以下操作:

Process process=Process.Start(new ProcessStartInfo("Your.exe") {
    RedirectStandardInput = true,
    RedirectStandardOutput = true,    
    RedirectStandardError = true,
    UseShellExecute = false,
});
process.StandardInput.WriteLine("Your command");
var yourAnswer=process.StandardOutput.ReadLine();

这只是一个简单的示例,也许还有其他解决方案可以与您的应用程序进行通信。好的搜索关键字是“IPC” :-)

于 2013-05-23T17:28:49.770 回答