2013-05-16 69 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」:-)