I have problem with making my program works on windows startup. Here's the code:
Sub RunAtStartup(ByVal PutAtStartup As Boolean, ByVal Name As String, ByVal Path As String)
Dim StartupPath As String = "Software\Microsoft\Windows\CurrentVersion\Run"
Dim myKey As Microsoft.Win32.RegistryKey
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(StartupPath, True)
If PutAtStartup = True Then
Try
myKey.SetValue(Name, Path)
Catch ex As Exception
ErrLog &= ex.ToString & vbNewLine
End Try
Else
Try
myKey.DeleteValue(Name, False)
Catch ex As Exception
ErrLog &= ex.ToString & vbNewLine
End Try
End If
End Sub
As you see above my program edit the registry on path "Software\Microsoft\Windows\CurrentVersion\Run" and the value it succefully inserted in the path. But the problem is my program dosen't works on windows startup what's the wrong?????
Note: my OS is windows 7 32bit.