[Tutorial]Run on Windows Start-Up

Posts 1–2 of 2 · Page 1 of 1
[Tutorial]Run on Windows Start-Up
Running on windows start if a few things you see in the hacking work(FEW NOT NEVER). Well it is a simple code using Registry. Let us begin shell we

first you will need to import win 32 for the registry
Code:
Imports Microsoft.Win32


now that we have imported win 32 we can now start the fun stuff. Adding an application to the list of start up program.
Code:
Private Sub AddCurrentKey(ByVal name As String, ByVal path As String) ' Adds to startup
        Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
        key.SetValue(name, path)
    End Sub

That code allow you to add the registry for you app to the start up list.

Code:
Private Sub RemoveCurrentKey(ByVal name As String) ' Removes from startup
        Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
        key.DeleteValue(name, False)
    End Sub

this code allow you to remove your application from the start up list ( th computer running to slow r what ever)

The Final Code is the option if u want to add or remove your program from start up and Save it if it cant save the application will close then just simple start from scratch
Code:
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked Then
            AddCurrentKey("StartupExample", System.Reflection.Assembly.GetEntryAssembly.Location)
            My.Settings.str = True
            My.Settings.Save()
        Else
            RemoveCurrentKey("StartupExample")
            My.Settings.str = False
            My.Settings.Save()
        End If
    End Sub


now for the load. If when the app load and Start up will always Change
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If My.Settings.str = True Then
            CheckBox2.Checked = True
        Else
            CheckBox2.Checked = False
        End If
End Sub


And your Finish that most to it as you can see it is very simple and is easy to do Enjoy.
hmmmmm another one?

Thanks for sharing, there are atleast two other one of these, but thanks anyway





Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us