我在注册表中有以下文件夹
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths
但是如何将它们的值名称显示到列表框?
这是我的代码:
Dim FontKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths")
For Each ValueName As String In FontKey.GetValueNames()
Dim Value As Object = FontKey.GetValue(ValueName) 'Get the value (data) of the specified value name.
If Value IsNot Nothing Then 'Make sure it exists.
ListBox1.Items.Add(Value.ToString())
End If
Next
FontKey.Close()
P / s:我收到此错误:(因为我没有创建新密钥所需的权限)
System.NullReferenceException:“对象引用未设置为对象的实例。”
FontKey 什么都不是。