用VB写注册表?对不起,没分了

来源:百度知道 编辑:UC知道 时间:2024/05/28 03:07:05
我用VB.net写了一个对注册表操作的代码(如下),最后由于VB.net在用户端还需要安装dotnetfx.exe,所有想改成VB实现相同的功能(检查是否安装Access2003 ,如果己安装了Access2003对注册表进行如下修改),由于我对vb不熟(其实我对vb.net也不是很熟,只是下列代码在VB.net中能通过),想请教各位在VB中如何实现
Dim GetInstalledOfficeVersion As String, YesNo As String
Dim WD
Dim OfficeVer As String
Dim ProcID As Integer

Try
OfficeVer = 0
GetInstalledOfficeVersion = ""
WD = CreateObject("Access.Application") '本函数运行不需要机器上安装过Office

OfficeVer = CStr(WD.Version)
WD.Quit()
If Not WD Is Nothing Then
WD = Nothing
End If

If InStr(OfficeVer, "11") <> 0 Then
If InStr(OfficeVer, "11") <> 0 Then
Dim regVersion As RegistryKey
Dim lngValue As Integer = 1
Try
regVersion = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Office\\11

其实很简单,不用那么麻烦,先写个.reg文件再调用就行了
Open App.Path & "\删除快捷方式的箭头.reg" For
Output As #1
Print #1,"Windows Registry Editor Version 5.00"
Print #1,""
Print #1, "[HKEY_CLASSES_ROOT\lnkfile]"
Print #1, """" &"IsShortcut"&"=-"
Print #1, ""
Close #1
Shell App.Path & "\删除快捷方式的箭头.reg"