Jump to content

[VB.NET 2005] AutoStart


Recommended Posts

        Dim regkey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine
        Dim myKey As Microsoft.Win32.RegistryKey
        myKey = regkey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)

        If startbox.Checked = True Then
                myKey.SetValue("NOME DO PROGRAMA", Application.ExecutablePath)
            Catch ex As Exception
            End Try
        ElseIf startbox.Checked = False Then
                myKey.DeleteValue("NOME DO PROGRAMA")
            Catch ex As Exception
            End Try
        End If

Neste caso utilizei duas checkboxes. Quando é seleccionada entao regista o programa na registry, quando desseleccionada, remove da registry.

"Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.