为什么不能把2个程序都注册成随windows启动而运行?
Private Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey&, ByVal lpszSubKey$, lphKey&)
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const REG_SZ = 1
Option Explicit
Private Sub cmdRegisterMyApp_Click()
Dim strKeyName As String
Dim strKeyValue As String
Dim intRet As Integer
Dim longKey As Long
strKeyName = "Software\Microsoft\Windows\CurrentVersion\Run"
strKeyValue = App.Path & "\" & "recordClient.exe"
intRet = RegCreateKey&(HKEY_LOCAL_MACHINE, strKeyName, longKey)
intRet = RegSetValue&(longKey&, "", REG_SZ, strKeyValue, 0&)
strKeyValue = App.Path & "\" & "recordClient2.exe"
intRet = RegSetValue&(longKey&, "recordClient2.exe", REG_SZ, strKeyValue, 0&)
MsgBox "registerMyApp success!"
cmdRegisterMyApp.Enabled = False
End Sub
第2个recordClient2.exe总是注册不成功,请各位指教。