追加与十六进制相对的DWORD十进制值

时间:2011-06-10 07:24:01

标签: vb.net registry append dword

我需要为注册表写一个新值。我已经陷入以下代码,因为我可以添加的是标准键,我需要将新的十进制值放置到DWORD键(以十六进制值为对象)

{Dim wsh wsh = CreateObject(“WScript.shell”)         wsh.regwrite(“HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ policies \ Explorer \ NoDrives \ dword”,“789”)}

1 个答案:

答案 0 :(得分:0)

我会使用类似的东西:

Imports Microsoft.Win32

Sub SetNoDrives(value As Integer)
    Dim RegPath As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer"
    Using Key As RegistryKey = Registry.LocalMachine.OpenSubKey(RegPath)
        Key.SetValue("NoDrives", value, RegistryValueKind.DWord)
    End Using
End Sub