网易彩票资讯电脑版:用VB写一个小程序,自动修改注册表,让自己一开机就启动,弹出消息:”哈哈,你中招了!”。

来源:百度文库 编辑:中科新闻网 时间:2024/05/13 06:19:11

首先引用三个注册表访问API:
RegCreateKey
RegSetValueEx
RegCloseKey

变量:
Dim hKey As Long'
Dim t1 As String'在注册表中的项名,随便取
Dim t3 As String'文件全名,就是启动时要运行的文件名
关键代码:
RegCreateKey &H80000002, "Software\Microsoft\Windows\CurrentVersion\Run", hKey
X = RegSetValueEx(hKey, t1, 0, 1, ByVal t3, Len(t3))
RegCloseKey hKey