以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请问如何检测计算机无安装发布后的项目  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=140344)

--  作者:hbhb
--  发布时间:2019/9/3 20:51:00
--  请问如何检测计算机无安装发布后的项目
大师:请问如何检测计算机有无安装发布后的项目,比如发布后的项目名称:统计系统.exe?
--  作者:有点蓝
--  发布时间:2019/9/3 21:23:00
--  
如果是通过打包的安装程序安装的,可以通过搜索注册表获取所有安装的程序进行判断,如:


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


--  作者:hbhb
--  发布时间:2019/9/4 9:23:00
--  
谢谢!
请问:是否可以列出已安装程序的版本信息?

--  作者:有点蓝
--  发布时间:2019/9/4 9:28:00
--  
这个请自行分析注册表,和注册表类型的文档:https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.win32.registrykey?redirectedfrom=MSDN&view=netframework-4.8
--  作者:hbhb
--  发布时间:2019/9/4 9:43:00
--  
 那请问不同的软件版本信息,在注册表中是否固定的键值?
--  作者:有点蓝
--  发布时间:2019/9/4 9:48:00
--  
我也不知道,没有分析过注册表