Dim reg = {"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"}
Dim tempType As String = Nothing
Dim softNum As Integer = 0
Dim currentKey As Microsoft.Win32.RegistryKey = Nothing
For Each item222 As String In reg
Dim displayName As Object = Nothing, uninstallString As Object = Nothing, installLocation As Object = Nothing, releaseType As Object = Nothing
Dim pregkey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(item222)
For Each item As String In pregkey.GetSubKeyNames()
currentKey = pregkey.OpenSubKey(item)
displayName = currentKey.GetValue("DisplayName")
installLocation = currentKey.GetValue("InstallLocation")
uninstallString = currentKey.GetValue("UninstallString")
releaseType = currentKey.GetValue("ReleaseType")
Dim isSecurityUpdate As Boolean = False
If releaseType IsNot Nothing Then
tempType = releaseType.ToString()
If tempType = "Security Update" OrElse tempType = "Update" Then
isSecurityUpdate = True
End If
End If
If Not isSecurityUpdate AndAlso displayName IsNot Nothing AndAlso uninstallString IsNot Nothing Then
softNum += 1
If installLocation Is Nothing Then
If displayName.ToString() = "统计系统" Then msgbox("有安装")
Output.Show(displayName.ToString() )
Else
Output.Show(displayName.ToString() & "," & installLocation.ToString)
End If
End If
Next
Next