VB.Net遍曆已安裝的程式卸載資訊

來源:互聯網
上載者:User

標籤:style   blog   color   io   os   ar   for   sp   div   

 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個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.