2013-05-16 258 views
2

我已经获得了开发Windows应用程序的任务,该应用程序充当现有C应用程序的包装器。 C应用程序由命令行控制。我想知道是否可以使用WPF作为此应用程序的GUI?将C应用程序与WPF集成

+3

当然有可能。你到目前为止遇到了什么问题? – jltrem

+0

你有这个应用程序的来源,还是你必须从你的.NET代码启动它的exe文件?在前者中,您正在寻找的关键字是'interop' – Jem

+0

感谢您的回答,这仍处于规划阶段。我确实有应用程序的源代码。 – Vercingetorix

回答

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”:-)

相关问题