zoukankan      html  css  js  c++  java
  • 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("SoftwareMicrosoftWindowsCurrentVersionUninstall")
    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                 uninstallString = currKey.GetValue("UninstallString")
    16                 releaseType = currKey.GetValue("ReleaseType")
    17                 Dim isSecurityUpdate = False
    18                 If releaseType IsNot Nothing Then
    19                     tempType = releaseType.ToString()
    20                     If tempType = "Security Update" OrElse tempType = "Update" Then
    21                         isSecurityUpdate = True
    22                     End If
    23                 End If
    24                 If (Not isSecurityUpdate) AndAlso _
    25                     (displayName IsNot Nothing) AndAlso _
    26                     (uninstallString IsNot Nothing) AndAlso
    27                     displayName = pgName Then
    28                     result = True
    29                     Exit For
    30                 End If
    31             Next item
    32         Catch
    33         Finally
    34             pregkey.Close()
    35         End Try
    36         Return result
    37     End Function
  • 相关阅读:
    数据结构-链式结构-队列
    c数据结构-线性结构-队列
    栈的四则运算的运用
    C++/C—函数指针
    向显存写数据x8086
    结构体内存偏移量
    MFC-ComboBox控件的使用
    MFC的Edit text编辑框控件
    C/C++反汇编-各种表达式(加减乘)
    MFC- 学习控件-静态文本
  • 原文地址:https://www.cnblogs.com/osiris/p/4038376.html
Copyright © 2011-2022 走看看