StartUp Application

sathya.cs

Active member
Joined
May 24, 2009
Messages
31
Programming Experience
Beginner
How to make an Application to startup at the system startup? and How to enable and disable?
 
If your making a console app, you can assign it to your windows services. Or there are register entries and/or placement in your startup directory that will do this.
 
I am a begginer ..so could just present some code to make a registry entry for start up form.....And its a Winforms
 
Create a key in the: HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\Run part of the registry and to remove the StartUp with windows, delete your key.
 
SetStartUpApplications(True) ' For creating Your application in start up
SetStartUpApplications(False) ' For Deleting Your application from start up

Public Sub SetStartUpApplications(ByRef Value As Boolean)
Dim strPath = """C:\Program Files\Your EXE """


Dim HKCU As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser
Dim key As Microsoft.Win32.RegistryKey = HKCU.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")

If (Value = True) Then
key.SetValue("Your Project name", strPath)

Else
key.DeleteValue("Your Project name", True)
End If
End Sub
 
Back
Top