473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to automatically start an application when windows starts up?

siddnair54
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?
Apr 19 '10 #1

✓ answered by ThatThatGuy

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 programmatically 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 IWshRuntimeLibrary 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....
Expand|Select|Wrap|Line Numbers
  1.            WshShellClass wshShell = new WshShellClass();
  2.                     IWshRuntimeLibrary.IWshShortcut smShortcut;
  3.                     smShortcut = (IWshRuntimeLibrary.IWshShortcut)wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\SystemMeter.lnk");
  4.                     smShortcut.TargetPath = Application.ExecutablePath;
  5.                     smShortcut.Description = "System Meter shortcut";
  6.                     smShortcut.Save();
  7.  
.................................................. .................................................. ........................

6 6484
tlhintoq
3,525 Expert 2GB
Stick a shortcut to it in StartMenu | Programs | Startup
Apr 19 '10 #2
@tlhintoq
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?
Apr 25 '10 #3
JamieHowarth0
533 Expert 512MB
@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
Apr 25 '10 #4
@codegecko
can you tell me how? please help me out with this.
Apr 27 '10 #5
jkmyoung
2,057 Expert 2GB
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?
Apr 27 '10 #6
ThatThatGuy
449 Expert 256MB
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 programmatically 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 IWshRuntimeLibrary 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....
Expand|Select|Wrap|Line Numbers
  1.            WshShellClass wshShell = new WshShellClass();
  2.                     IWshRuntimeLibrary.IWshShortcut smShortcut;
  3.                     smShortcut = (IWshRuntimeLibrary.IWshShortcut)wshShell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\SystemMeter.lnk");
  4.                     smShortcut.TargetPath = Application.ExecutablePath;
  5.                     smShortcut.Description = "System Meter shortcut";
  6.                     smShortcut.Save();
  7.  
.................................................. .................................................. ........................
Apr 28 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: AW | last post by:
Hello, I have a method to initialize my application, which reads configuration settings, establishes connections, and loads a bunch of data. It lasts for several seconds. This method is...
0
by: MS Newsgroups | last post by:
Hi, Can someone please advise how to automatically start a application when a user logs on. I have tried using the Run registry key, but this fails because the application reads configuration...
7
by: etam | last post by:
How, by code can i set the program to be started when windows is started? Do sth with some files like in linux or what? -- Pozdrawiam, Etam.
3
by: New user | last post by:
How can I programmatically start a windows application when windows loads. Can I get the code to do that, I'd rather do it with code than with the setup & deployment wizard. I'd also like to be...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
1
by: ayeung | last post by:
Hi, I have written a GUI application that I want to automatically run on a Linux system (Fedora Core 6) upon powerup. I've created a script which runs correctly and have added a run script using...
2
by: Blair | last post by:
Can someone please tell me how to start my application when Windows starts up or when someone logs on (vb 2005) ?
3
by: mikeyeli | last post by:
Good Day people! i need to make an application im making, start when windows starts, i just wanted to ask you how can i do this, or to point me in the right direction. Thanks!
2
by: varunkumarid | last post by:
Hi to all I have one C# Console Application in Server. If suppose the Server is switch off by some reason and somebody switch on the server means i have to rerun the application through the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.