看看这个啊 他说可以让程序在开机是自动运行,但是
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPrivate 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 ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Const REG_SZ = 1 ' Unicode nul terminated string
上面的是API 生命啊
Private Sub Command1_Click()
subkey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Exe = "Notepad"
RegCreateKey HKEY_CURRENT_USER, subkey, hKey
RegSetValueEx hKey, "记事本", 0, REG_SZ, ByVal Exe, LenB(StrConv(Exe, vbFromUnicode)) + 1
RegCloseKey hKey
End Sub