本文整理汇总了VB.NET中Microsoft.Win32.RegistryHive枚举的典型用法代码示例。如果您正苦于以下问题:VB.NET RegistryHive枚举的具体用法?VB.NET RegistryHive怎么用?VB.NET RegistryHive使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了RegistryHive枚举的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
开发者ID:VB.NET开发者,项目名称:Microsoft.Win32,代码行数:46,代码来源:RegistryHive
注:本文中的Microsoft.Win32.RegistryHive枚举示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论