How to automatically start an application when windows starts up?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siddnair54
    New Member
    • Apr 2010
    • 9

    How to automatically start an application when windows starts up?

    Hey Guys, i have created a windows application in c#.
    I want to create a setup in such a way that once the application is installed, it should start automatically when the windows starts up. Can you help me with this?
    Can i put the application in System tray or something, or is there any other way?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Stick a shortcut to it in StartMenu | Programs | Startup

    Comment

    • siddnair54
      New Member
      • Apr 2010
      • 9

      #3
      Originally posted by tlhintoq
      Stick a shortcut to it in StartMenu | Programs | Startup
      but if i deploy the app, how would users know tat?
      can i create a setup which will automatically add the shortcut in the startup folder?

      Comment

      • JamieHowarth0
        Recognized Expert Contributor
        • May 2007
        • 537

        #4
        @siddnair54, it depends on how you're deploying the application. If you're using a Windows setup project template in Visual Studio then you can specify in the project to present to the installing user the options for shortcuts on Desktop, Start Menu, & Quick Launch.

        Best,

        codegecko

        Comment

        • siddnair54
          New Member
          • Apr 2010
          • 9

          #5
          Originally posted by codegecko
          @siddnair54, it depends on how you're deploying the application. If you're using a Windows setup project template in Visual Studio then you can specify in the project to present to the installing user the options for shortcuts on Desktop, Start Menu, & Quick Launch.

          Best,

          codegecko
          can you tell me how? please help me out with this.

          Comment

          • jkmyoung
            Recognized Expert Top Contributor
            • Mar 2006
            • 2057

            #6
            At this point, we need more information. How do you install your program on the user's computer? Are you using a windows MSI to install the program? What are you using to develop your installation package?

            Comment

            • ThatThatGuy
              Recognized Expert Contributor
              • Jul 2009
              • 453

              #7
              There's absolutely no need to create a setup package....
              Many gadgets don't need a setup .... you can always have a direct run program....

              To Show your program in the systemtray... you can use NotifyIcon control...

              and to programmaticall y enable your program to run at startup you can do the following:

              Add a reference to 'Windows Scripting Host Object Model' COM Library....
              This system library named IWshRuntimeLibr ary helps you to create a .lnk file which will be then pasted to your Startup folder.... which will help your application to run at startup....

              Use this code to create a shortcut....
              Code:
                         WshShellClass wshShell = new WshShellClass();
                                  IWshRuntimeLibrary.IWshShortcut smShortcut;
                                  smShortcut = (IWshRuntimeLibrary.IWshShortcut)wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\SystemMeter.lnk");
                                  smShortcut.TargetPath = Application.ExecutablePath;
                                  smShortcut.Description = "System Meter shortcut";
                                  smShortcut.Save();
              ............... ............... ............... ............... ............... ............... ............... ............... ....

              Comment

              Working...