2011-06-10 132 views
2

我需要爲註冊表編寫一個新值。我來被困在下面的代碼,因爲我可以補充的是一個標準的關鍵,我需要一個新的十進制值放置到一個DWORD鍵(aposed爲十六進制值)附加DWORDs十進制值與十六進制相結合

{昏暗WSH WSH =的CreateObject(」 WScript.shell 「) wsh.regwrite(」 HKEY_LOCAL_MACHINE \ SOFTWARE \微軟\的Windows \ CurrentVersion \政策\ Explorer中\ NoDrives \ DWORD」, 「789」)}

回答

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