-
February 2nd, 2005, 04:14 AM
#1
Making my application a startup program?
I have just finished writing a program in Visual Basic.NET and would like for it to automatically make itself a startup program (one of the processes that starts automatically when Windows starts) during run time. Is there a way to program this right into the code itself, without having to make an installation file? For example, if I had a button on my form that said "Make me a starup program!", the user can click it and it would execute the necessary code to do this. What exactly would be the code for this button? Any help would be greatly appreciated!
Thanks,
Chopinzee
-
February 2nd, 2005, 11:28 AM
#2
Re: Making my application a startup program?
Just put the EXE or a shortcut to it in the Startup folder.
-
February 2nd, 2005, 12:21 PM
#3
Re: Making my application a startup program?
Yes but I don't want the end user to have to copy the program to the startup folder themselves, I want the program to do it automatically during run time.
-
February 3rd, 2005, 02:20 AM
#4
Re: Making my application a startup program?
hi why dont you put the code in a window service and make it start automatically as OS starts. i think its a better option. sorry i had the same idea to copy the exe in Startup folder. anyways
-
February 3rd, 2005, 12:37 PM
#5
Re: Making my application a startup program?
Alternately you can manually create a new string value registry key in:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run\
I would caution that improperly adding an application as a startup item can have harsh and unexpected results. Edit the Windows registry at your own risk.
DS
-
February 3rd, 2005, 02:24 PM
#6
Re: Making my application a startup program?
Originally Posted by 4461766964
Alternately you can manually create a new string value registry key in:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run\
I would caution that improperly adding an application as a startup item can have harsh and unexpected results. Edit the Windows registry at your own risk.
DS
So how do you do this? Like what would the code be for example?
-
February 7th, 2005, 02:38 AM
#7
Re: Making my application a startup program?
Surely someone must know...
-
February 7th, 2005, 01:27 PM
#8
Re: Making my application a startup program?
I don't have much time to show you but check that namespace in .NEt
microsoft.Win32
should help you out with the registry.
Nicolas Bohemier
-
February 15th, 2005, 10:25 PM
#9
Re: Making my application a startup program?
I know in C# the code is as folows
include this using statement using Microsoft.Win32;
create a registry key object
RegistryKey rootkey,pKey,sKey;
then the fun begins the following line is how to open a connection
rootkey = Registry.LocalMachine.OpenSubKey("Software", true) this can be any key
once the initial connection is made you have to make the keys in the registry to store you're data
pKey = rootkey.CreateSubKey("KeyName"); this creates a key under Software
sKey = pKey.CreateSubKey("KeyName"); this creates a key under the one created with pKey;
now to set values use the sKey object to create them
sKey.CreateKey("Key Name", (string)Keyvalue);
sKey.CreateKey("Key Name", (int)Keyvalue);
and so on then use
sKey.Close();
pKey.Close();
rootkey.Close();
this is what i have done if any further help is needed email me at jscheibe@cogeco.ca
Josh
-
February 18th, 2005, 03:20 PM
#10
Re: Making my application a startup program?
If you don't want to copy the exe to the startup folder, you could create a shortcut to the exe in the startup folder.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|