Your application will not be able to detect (by itself), it was launched at startup or by the usual launch of the user. However, you can pass arguments to your application, and then correct your application correctly. Here is an example:
First run the program.cs main method. Now, by default, you do not see the passed startup arguments. However, adding the string[] args parameter to the main() method will display the command arguments. For instance,
static class Program { public static bool LaunchedViaStartup { get; set; } /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { Program.LaunchedViaStartup = args != null && args.Any(arg => arg.Equals("startup", StringComparison.CurrentCultureIgnoreCase)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }
Now the code is simple, we set a static variable in the Program class called LaunchedViaStartup , and then before starting our main form, we check to see if the command argument contains our special startup argument (via Linq). The name for this argument is just up to you.
Now in our main form (yes the main one) we have access to this property for the lifetime of the application.
public partial class Form1 : Form { public Form1() { InitializeComponent(); MessageBox.Show(this, string.Format("Lanched Via Startup Arg:{0}", Program.LaunchedViaStartup)); } }
Finally, to verify this, you can simply open the Project Properties window and set Command line arguments , as shown in the screenshot below.

Finally, to test the Startup argument outside of visual studio, add the start argument to your shortcut, such as the screenshot below.
