繁体   English   中英

如何检查注册表文件夹是否被删除

[英]How to check If registry folder is deleted or not

我已经在其中创建了一个文件夹和一个子文件夹,并尝试检查注册表编辑器中是否存在该文件夹。

这是我创建的方式:

Dim  kstrRegSubKeyName As String = "CompanyName\\SoftwareName"
Dim oReg As Microsoft.Win32.RegistryKey
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True)
oReg = oReg.CreateSubKey(kstrRegSubKeyName)
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\" & kstrRegSubKeyName)

现在,我需要检查CompanyName文件夹是否已删除并显示一条消息。

我怎么做?

我会喜欢这样的:

     Dim rkKey As RegistryKey = Nothing
     Dim Value As New String("CompanyName")
     Dim MainKey as RegistryKey = Registry.CurrentUser.OpenSubKey("Software", True)  
    rkKey = MainKey.OpenSubKey(value, True)
    'check to see if the subkey exists
    If rkKey Is Nothing Then 'it doesnt exist
        'Do stuff
    Else
      'Do other stuff
    End If

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM