本文整理汇总了VB.NET中Microsoft.Win32.RegistryKey.OpenRemoteBaseKey方法的典型用法代码示例。如果您正苦于以下问题:VB.NET RegistryKey.OpenRemoteBaseKey方法的具体用法?VB.NET RegistryKey.OpenRemoteBaseKey怎么用?VB.NET RegistryKey.OpenRemoteBaseKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Win32.RegistryKey
的用法示例。
在下文中一共展示了RegistryKey.OpenRemoteBaseKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: RemoteKey
' 导入命名空间
Imports System.IO
Imports System.Security.Permissions
Imports Microsoft.Win32
Public Class RemoteKey
Shared Sub Main(commandLineArgs As String())
Dim environmentKey As RegistryKey
' Check that an argument was specified when the
' program was invoked.
If commandLineArgs.Length = 0 Then
Console.WriteLine("Error: The name of the remote " & _
"computer must be specified as input on the " & _
"command line.")
Return
End If
Try
' Open HKEY_CURRENT_USER\Environment on a remote computer.
environmentKey = RegistryKey.OpenRemoteBaseKey( _
RegistryHive.CurrentUser, _
commandLineArgs(0)).OpenSubKey("Environment")
Catch ex As IOException
Console.WriteLine("{0}: {1}", _
ex.GetType().Name, ex.Message)
Return
End Try
' Print the values.
Console.WriteLine("\nThere are {0} values For {1}.", _
environmentKey.ValueCount.ToString(), environmentKey.Name)
For Each valueName As String In environmentKey.GetValueNames()
Console.WriteLine("{0,-20}: {1}", valueName, _
environmentKey.GetValue(valueName).ToString())
Next
' Close the registry key.
environmentKey.Close()
End Sub
End Class