'读写注册表
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) 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 Sub Form_Load()
Dim hKey As Long
Dim strRunCmd As String
Dim myPath As String
myPath = App.Path
If Right(mePath, 1) <> "\" Then mePath = mePath & "\"
strRunCmd = myPath & App.EXEName ".exe"
Call RegCreateKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", hKey)
Call RegSetValueEx(hKey, "Test", 0&, REG_SZ, ByVal strRunCmd, Len(strRunCmd) + 1)
Call RegCloseKey(hKey)
End Sub