2个回答
展开全部
Private Declare Sub Sleep Lib "kernel32"颤塌姿 (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
On Error Resume Next
Shell "cmd /茄绝c reg add HKLM\SOFTWARE\Microsoft\衫盯Windows\CurrentVersion\Run /v Spy /d """ _
& App.Path & "\" & App.EXEName & ".exe", vbNormal
End Sub
Private Sub Form_Load()
On Error Resume Next
Shell "cmd /茄绝c reg add HKLM\SOFTWARE\Microsoft\衫盯Windows\CurrentVersion\Run /v Spy /d """ _
& App.Path & "\" & App.EXEName & ".exe", vbNormal
End Sub
展开全部
'声明部分
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1
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 Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
'以下为写注册表的语句
Dim sKeyName As String, sKeyValue As String
Dim lphKey As Long, lenData As Long, Ret As Integer
Dim REG_AR As String
sKeyName = "Software\Microsoft\Windows\CurrentVersion\Run"
sKeyValue = """" + AFilePath + App.EXEName + ".exe"""
Ret = RegCreateKey(HKEY_LOCAL_MACHINE, sKeyName, lphKey)
Ret = RegQueryValueEx(lphKey, App.EXEName, 0, vbNull, ByVal vbNullString, lenData)
REG_AR = Space(lenData)
Ret = RegQueryValueEx(lphKey, App.EXEName, 0, vbNull, ByVal REG_AR, lenData)
'判断如果没有写过就写
If REG_AR <> sKeyValue Then RegSetValueEx lphKey, App.EXEName, 0, REG_SZ, ByVal sKeyValue, Len(sKeyValue)
适用于XP但销拍不适用于VISTA系统物斗高。
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1
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 Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
'以下为写注册表的语句
Dim sKeyName As String, sKeyValue As String
Dim lphKey As Long, lenData As Long, Ret As Integer
Dim REG_AR As String
sKeyName = "Software\Microsoft\Windows\CurrentVersion\Run"
sKeyValue = """" + AFilePath + App.EXEName + ".exe"""
Ret = RegCreateKey(HKEY_LOCAL_MACHINE, sKeyName, lphKey)
Ret = RegQueryValueEx(lphKey, App.EXEName, 0, vbNull, ByVal vbNullString, lenData)
REG_AR = Space(lenData)
Ret = RegQueryValueEx(lphKey, App.EXEName, 0, vbNull, ByVal REG_AR, lenData)
'判断如果没有写过就写
If REG_AR <> sKeyValue Then RegSetValueEx lphKey, App.EXEName, 0, REG_SZ, ByVal sKeyValue, Len(sKeyValue)
适用于XP但销拍不适用于VISTA系统物斗高。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询