Using VB.Net 2005, I want to Access the Registry Location -(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrnetVersion\App Paths) where we can get all the applications that has been loaded to the system.
I used the GetSetting function, but it doesn't seem to work for that location. Can someone tell how to access this registry location ?
Regards
Sekhar.
AlanPosted Nov 5, 2007, 5:58 AM
This code worked OK for my machine when I tried it just now:
Imports System
Imports Microsoft.Win32
Class Test
Shared Sub Main()
Console.Clear()
Dim apps As String() = GetApps()
If (apps is Nothing)
Console.WriteLine("No applications were found")
Else
Console.WriteLine("The following applications are installed:")
Console.WriteLine()
For Each app As String In apps
Console.WriteLine(app)
Next
End If
Console.ReadKey()
End Sub
Public Shared Function GetApps() As String()
Dim rk As RegistryKey
Dim appsKey As String = "Software\Microsoft\Windows\CurrentVersion\App
Paths"
rk = Registry.LocalMachine.OpenSubKey(appsKey)
If rk Is Nothing Then
Return Nothing
Else
Dim apps As String() = rk.GetSubKeyNames()
rk.Close()
Return apps
End If
End Function
End Class