开发者

how to access remote registry access between xp and vista using vb.net?

I have to access remo开发者_JAVA技巧te connection from XP os to Vista os in vb.net How to do that?


Here's something that help you:

    '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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜