D
Devon_Nullman
Guest
This is a form with a button and a multiline textbox
Code:
Option Strict On
Imports Microsoft.Win32
Public Class Form1
Const RegKey As String = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Using rk As RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey(RegKey, False)
Dim O As Object
Dim RegTypes As New List(Of String)
Dim Names As New List(Of String)
Dim Kind As RegistryValueKind
Dim Padlength As Integer = 0
For Each S As String In rk.GetValueNames
Names.Add(S)
O = rk.GetValue(S, Nothing)
If Not O Is Nothing Then
Kind = rk.GetValueKind(S)
If Kind = RegistryValueKind.Binary Then
RegTypes.Add(Kind.ToString & " (" & DirectCast(O, System.Array).Length.ToString & ")")
Else
RegTypes.Add(Kind.ToString)
End If
End If
Next
For Each Name As String In Names
If Name.Length > Padlength Then Padlength = Name.Length
Next
Padlength += 2
TextBox1.Text = "Contents of HKLM\" & RegKey & vbNewLine & vbNewLine
TextBox1.AppendText("Entry Name".PadRight(Padlength + 3) & "Entry Type" & vbNewLine)
For I As Integer = 0 To Names.Count - 1
TextBox1.AppendText((I + 1).ToString("00") & "-" & Names(I).PadRight(Padlength) & RegTypes(I) & vbNewLine)
Next
End Using
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Me.Text = "Running in " & (IntPtr.Size * 8).ToString & "bit Mode"
End Sub
End Class
Why are the results different in "Any CPU" versus "x86"? My Computer is 64 bit
Continue reading...
Code:
Option Strict On
Imports Microsoft.Win32
Public Class Form1
Const RegKey As String = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Using rk As RegistryKey = My.Computer.Registry.LocalMachine.OpenSubKey(RegKey, False)
Dim O As Object
Dim RegTypes As New List(Of String)
Dim Names As New List(Of String)
Dim Kind As RegistryValueKind
Dim Padlength As Integer = 0
For Each S As String In rk.GetValueNames
Names.Add(S)
O = rk.GetValue(S, Nothing)
If Not O Is Nothing Then
Kind = rk.GetValueKind(S)
If Kind = RegistryValueKind.Binary Then
RegTypes.Add(Kind.ToString & " (" & DirectCast(O, System.Array).Length.ToString & ")")
Else
RegTypes.Add(Kind.ToString)
End If
End If
Next
For Each Name As String In Names
If Name.Length > Padlength Then Padlength = Name.Length
Next
Padlength += 2
TextBox1.Text = "Contents of HKLM\" & RegKey & vbNewLine & vbNewLine
TextBox1.AppendText("Entry Name".PadRight(Padlength + 3) & "Entry Type" & vbNewLine)
For I As Integer = 0 To Names.Count - 1
TextBox1.AppendText((I + 1).ToString("00") & "-" & Names(I).PadRight(Padlength) & RegTypes(I) & vbNewLine)
Next
End Using
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Me.Text = "Running in " & (IntPtr.Size * 8).ToString & "bit Mode"
End Sub
End Class
Why are the results different in "Any CPU" versus "x86"? My Computer is 64 bit
Continue reading...