Last active
October 24, 2019 18:58
-
-
Save Laim/725d322fb40afc52f4d19f2864927563 to your computer and use it in GitHub Desktop.
Get Subkeys in registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports YourApp.Registry | |
Public Class frmMain | |
Private Sub btnRegGet_Click(sender As Object, e As EventArgs) Handles btnRegGet.Click | |
Try | |
lbKeys.Items.Clear() | |
For Each i In getKeys("SOFTWARE\Google") | |
lbKeys.Items.Add(i.ToString) | |
Next | |
Catch ex As Exception | |
MsgBox(ex.ToString) | |
End Try | |
End Sub | |
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports Microsoft.Win32 | |
Public Class Registry | |
Shared Function getKeys(RegPath As String) | |
Dim Keys As New List(Of String) | |
Using hklm As RegistryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, IIf(Environment.Is64BitOperatingSystem, RegistryView.Registry64, RegistryView.Registry32)) | |
Using key As RegistryKey = hklm.OpenSubKey(RegPath) | |
For Each i In key.GetSubKeyNames | |
Keys.Add(i.ToString) | |
Next | |
End Using | |
End Using | |
Return Keys | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment