Open an Application .exe window inside another application
- by jpnavarini
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.