Hello, I need to keep the exe's window (for example Notepad) always on the foreground of the form, it means that even if we click on the form , the exe's window will always be ahead of the form.In other words,I have a button which when we click on it, it launches the exe and the exe's window will appear. If we click on the form the exe's window must remain at it's place.
This is what I did:
Process myProcess = new Process();
try
{
this.TopMost = false;
string winpath = Environment.GetEnvironmentVariable("windir");
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = winpath+@"\system32\notepad.exe";
myProcess.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Thank you.