I have C# winforms application that needs to start an external exe from time to time, but I do not wish to start another process if one is already running, but rather switch
Mnebuerquo wrote:
Also, I had source code access to the process I was trying to start. If you can not modify the code, adding the mutex is obviously not an option.
I don't have source code access to the process I want to run.
I have ended up using the proccess MainWindowHandle to switch to the process once I have found it is alread running:
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetForegroundWindow(IntPtr hWnd);