![复制代码](https://i-blog.csdnimg.cn/blog_migrate/69c5a8ac3fa60e0848d784a6dd461da6.gif)
1 Private Shared Function ProgramExists(ByVal pgName As String) As Boolean
2 Dim temp As String = Nothing
3 Dim tempType As String = Nothing
4 Dim displayName As Object = Nothing
5 Dim uninstallString As Object = Nothing
6 Dim releaseType As Object = Nothing
7 Dim currKey As RegistryKey = Nothing
8 Dim softNum As Integer = 0
9 Dim pregkey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
10 Dim result = False
11 Try
12 For Each item As String In pregkey.GetSubKeyNames()
13 currKey = pregkey.OpenSubKey(item)
14 displayName = currKey.GetValue("DisplayName")
15 unins