VB Auto StartUp
Program ini untuk mendaftarkan secara otomatis pada StartUp :
Command 1
untuk mendaftarkan ke StartUp
Command 2
untuk menghapus dari StartUp
Yang diperlukan untuk membuat program ini hanya 2 Command button :
Form1:
Code:
Private Declare Function RegDeleteValue Lib “advapi32.dll” Alias “RegDeleteValueA” (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegSetValueEx Lib “advapi32.dll” Alias “RegSetValueExA” (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegOpenKeyEx Lib “advapi32.dll” Alias “RegOpenKeyExA” (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Const REG_SZ = 1
Const HKEY_CURRENT_USER = &H80000001
Const REGKEY = “Software\Microsoft\Windows\CurrentVersion\Run”
Const KEY_WRITE = &H20006
Dim Path As Long
Private Sub Command1_Click()
If RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY, 0, KEY_WRITE, Path) Then Exit Sub
RegSetValueEx Path, App.Title, 0, REG_SZ, ByVal App.Path & “\” & “Shadow Angel” & “.exe”, Len(App.Path & “\” & App.EXEName & “.exe”)
End Sub
Private Sub Command2_Click()
If RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY, 0, KEY_WRITE, Path) Then Exit Sub
RegDeleteValue Path, App.Title
End Sub