快捷导航 上传作品

[c++] vb注册表操作

[复制链接]
梅雷工具箱发表于 2015-6-25 13:36:26 | 显示全部楼层 |阅读模式


vb注册表操作



注册表文件位置 = "HKLM\SOFTWARE\MeiLei_UG_WG\VIP"
Set HJonny = CreateObject("wscript.shell")
n = HJonny.regread(注册表文件位置)          '读注册表
HJonny.regwrite 注册表文件位置, n           '写注册表

=============================================
'判断文件运行次数  【读写 注册表】

Private Sub Form_Load()
On Error Resume Next    '容错报错,这个是把错误跳过去
Dim HJonny
Dim n As Single
Dim 注册表文件位置 As String

注册表文件位置 = "HKLM\SOFTWARE\MeiLei_UG_WG\VIP"

Set HJonny = CreateObject("wscript.shell")
n = HJonny.regread(注册表文件位置)          '读注册表
n = n + 1
HJonny.regwrite 注册表文件位置, n           '写注册表
MsgBox "程序第" & n & "次运行!"
End
End Sub

=============================================
'判断注册表是否存在
Private Sub Form_Load()
On Error GoTo ErrorMsg
Dim WshShell As Object, temp As String
Set WshShell = CreateObject("wscript.shell")
temp = "HKEY_LOCAL_MACHINE\"
WshShell.RegRead (temp) '如果无法读取直接产生一个错误,进入到errormsg显示信息
MsgBox "找到:" & temp
GoTo lll:
ErrorMsg:
MsgBox "没有找到:" & temp
lll:
End
End Sub

===========================================


_____________________________________________________________________________ _

中磊UG二次开发教程 梅雷著 qq1821117007
学UG就上UG网 http://www.9sug.com/
就上UG网淘宝直营店
回复

使用道具 评分 举报

您需要登录后才可以回帖 登录 | 注册UG网

本版积分规则