Start External Application

CodeKeep C# Feed Maggio 26th, 2008

Description: A simple method of starting an external application

Link: http://www.codekeep.net/snippets/f915fc5b-a717-4f2e-a21e-fdf3cfe95947.aspx

[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClass, string lpTitle); 

/// <summary>
/// Starts a specified app if not running
/// </summary>
/// <param name="appName">The name of the app</param>
/// <param name="pathToYourExe">The path to the app exe</param>
void StartSpp(string appName, string pathToYourExe)
{
	if (FindWindow(null, appName) == System.IntPtr.Zero)
        {
            Process.Start(pathToYourExe);
        }
}

  • .NET
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Comments are closed.

Trackback URI |