当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET RegistryKey.OpenRemoteBaseKey方法代码示例

本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:Microsoft.Win32,代码行数:46,代码来源:RegistryKey.OpenRemoteBaseKey


注:本文中的Microsoft.Win32.RegistryKey.OpenRemoteBaseKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。