Windows startup question

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
hello. Here is my problem.

I have a checkbox "Run at startup"

VB.NET:
        Private Sub chkStartup_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkStartup.CheckedChanged
            If chkStartup.Checked = True Then
                Dim AppPath As String = "C:\Documents and Settings\Sam\My Documents\Visual Studio 2008\Projects\ImageShack vb.net\ImageShackAPIWrapperClient\obj\Release\WebRequest.exe"
                Dim CU As Microsoft.Win32.RegistryKey = _
        Registry.CurrentUser.CreateSubKey _
        ("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

                With CU
                    .OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
                    .SetValue("WebRequest", AppPath)
                End With
            Else
                'delete key
            End If

        End Sub

Works great but, what happens when i want to release it? How can i get the application to auto find its apppath??? so i dont have to write C:\BLA BLA\BLA
 

Latest posts

Back
Top