Open an Application .exe window inside another application

Posted by jpnavarini on Stack Overflow See other posts from Stack Overflow or by jpnavarini
Published on 2012-03-23T21:11:46Z Indexed on 2012/03/23 23:29 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I have an application in WPF running. I would like that, when a button is clicked inside this application, another application opens, with its window maximized. However, I don't want my first application to stop and wait. I want both to be open and running independently.

When the button is clicked again, in case the application is minimized, the application is maximized. In case it is not, it is open again.

How is it possible using C#? I have tried the following:

Process process = Process.GetProcesses().FirstOrDefault(f => f.ProcessName.Contains("Analysis"));

ShowWindow((process ?? Process.Start("..\\..\\..\\MS Analysis\\bin\\Debug\\Chemtech.RT.MS.Analysis.exe")).MainWindowHandle.ToInt32(), SW_MAXIMIZE);

But the window does not open, even though the process does start.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf