首页 > 代码库 > VB.Net遍历已安装的程序卸载信息
VB.Net遍历已安装的程序卸载信息
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 = False11 Try12 For Each item As String In pregkey.GetSubKeyNames()13 currKey = pregkey.OpenSubKey(item)14 displayName = currKey.GetValue("DisplayName")15 uninstallString = currKey.GetValue("UninstallString")16 releaseType = currKey.GetValue("ReleaseType")17 Dim isSecurityUpdate = False18 If releaseType IsNot Nothing Then19 tempType = releaseType.ToString()20 If tempType = "Security Update" OrElse tempType = "Update" Then21 isSecurityUpdate = True22 End If23 End If24 If (Not isSecurityUpdate) AndAlso _25 (displayName IsNot Nothing) AndAlso _26 (uninstallString IsNot Nothing) AndAlso27 displayName = pgName Then28 result = True29 Exit For30 End If31 Next item32 Catch33 Finally34 pregkey.Close()35 End Try36 Return result37 End Function
VB.Net遍历已安装的程序卸载信息
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。