如何使用 vb.net 访问 xp 和 vista 之间的远程注册表访问?

Posted

技术标签:

【中文标题】如何使用 vb.net 访问 xp 和 vista 之间的远程注册表访问?【英文标题】:how to access remote registry access between xp and vista using vb.net? 【发布时间】:2011-01-10 18:34:43 【问题描述】:

我必须在 vb.net 中访问从 XP 操作系统到 Vista 操作系统的远程连接 该怎么做?

【问题讨论】:

【参考方案1】:

这里有一些可以帮助你的东西:

    'Set the machine name
    Dim MachineName = "file-server"
    'This will hold the value of the query if successful
    Dim Value As String = Nothing
    'Open the remote HKLM hive
    Dim Reg = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, MachineName)
    'Open the key
    Dim Key = Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion")
    'OpenSubKey returns Nothing on keys that don't exist so make sure we've got something
    If Key IsNot Nothing Then
        'Grab the value
        Value = Key.GetValue("CommonFilesDir")
    Else
        'Unable to open key, do something here
    End If
    'Very important, close the key and the hive
    Key.Close()
    Reg.Close()
    Trace.WriteLine(Value)

【讨论】:

以上是关于如何使用 vb.net 访问 xp 和 vista 之间的远程注册表访问?的主要内容,如果未能解决你的问题,请参考以下文章

vb.net(VS2010) vista下 修改注册表

VB.net 中的 IP 地址查找(XP 与 Windows 7)

如何录制特定应用程序的音频? vb.net

Vista 中的 VB6 .NET 互操作问题

如何让我的 VB.net 程序在 Windows XP 上运行?

如何制作与 Vista/7 和 XP 兼容的图标?