1[System.Runtime.InteropServices.DllImport("user32.dll")]
2public static extern IntPtr FindWindow(string lpClass, string lpTitle);
3
4/// <summary>
5/// Starts a specified app if not running
6/// </summary>
7/// <param name="appName">The name of the app</param>
8/// <param name="pathToYourExe">The path to the app exe</param>
9void StartSpp(string appName, string pathToYourExe)
10{
11 if (FindWindow(null, appName) == System.IntPtr.Zero)
12 {
13 Process.Start(pathToYourExe);
14 }
15}