Listar Programas Instalados
Publicado: 10 Sep 2014, 16:39
Bueno aquí dejo una función que hice hace unos días.
Saludos
Código: Seleccionar todo
;Danyfirex 06/09/2014
#include <Array.au3>
Opt("MustDeclareVars", 1)
Global Const $sTagAppInfoData = "UINT cbSize;UINT dwMask;ptr pszDisplayName;ptr pszVersion;ptr pszPublisher;ptr pszProductID;" & _
"ptr pszRegisteredOwner;ptr pszRegisteredCompany;ptr pszLanguage;ptr pszSupportUrl;ptr pszSupportTelephone;" & _
"ptr pszHelpLink;ptr pszInstallLocation;ptr pszInstallSource;ptr pszInstallDate;ptr pszContact;ptr pszComments;" & _
"ptr pszImage;ptr pszReadmeUrl;ptr pszUpdateInfoUrl"
Global Const $sCLSID_EnumInstalledApps = "{0B124F8F-91F0-11D1-B8B5-006008059382}"
Global Const $sIID_IEnumInstalledApps = "{1BC752E1-9046-11D1-B8B3-006008059382}"
Global Const $sTagIEnumInstalledApps = "Next hresult(ptr*);Reset hresult();"
Global Const $sIID_IShellApp = "{A3E14960-935F-11D1-B8B8-006008059382}"
Global Const $sShellApp = "GetAppInfoData hresult(ptr);"
Global Const $AIM_DISPLAYNAME = 0x00000001
Global Const $AIM_VERSION = 0x00000002
Global Const $AIM_PUBLISHER = 0x00000004
Global Const $AIM_PRODUCTID = 0x00000008
Global Const $AIM_REGISTEREDOWNER = 0x00000010
Global Const $AIM_REGISTEREDCOMPANY = 0x00000020
Global Const $AIM_LANGUAGE = 0x00000040
Global Const $AIM_SUPPORTURL = 0x00000080
Global Const $AIM_SUPPORTTELEPHONE = 0x00000100
Global Const $AIM_HELPLINK = 0x00000200
Global Const $AIM_INSTALLLOCATION = 0x00000400
Global Const $AIM_INSTALLSOURCE = 0x00000800
Global Const $AIM_INSTALLDATE = 0x00001000
Global Const $AIM_CONTACT = 0x00004000
Global Const $AIM_COMMENTS = 0x00008000
Global Const $AIM_IMAGE = 0x00020000
Global Const $AIM_READMEURL = 0x00040000
Global Const $AIM_UPDATEINFOURL = 0x00080000
Local $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE))
_ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "NAME|INSTALLDATE")
$aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_UPDATEINFOURL))
_ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|UPDATEINFOURL")
$aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE, $AIM_INSTALLLOCATION))
_ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|INSTALLLOCATION|INSTALLDATE")
Func GetInstalledApps($iMask = $AIM_DISPLAYNAME)
Local $oEnumInstalledApps = ObjCreateInterface($sCLSID_EnumInstalledApps, $sIID_IEnumInstalledApps, $sTagIEnumInstalledApps)
If @error Then Return 0
Local $pShellApp = 0
Local $oShellApp = 0
Local $AppInfoData = DllStructCreate($sTagAppInfoData)
Local $pAppInfoData = DllStructGetPtr($AppInfoData)
Local $i = 0
Local $aArray[0][0]
Local $iF = 1
Local $tData = 0
Local $sData = ""
Local $aMax = nCol($iMask)
While $oEnumInstalledApps.Next($pShellApp) = 0 And $pShellApp <> 0
$oShellApp = ObjCreateInterface($pShellApp, $sIID_IShellApp, $sShellApp)
If @error Then Return 0
DllStructSetData($AppInfoData, "cbSize", DllStructGetSize($AppInfoData))
DllStructSetData($AppInfoData, "dwMask", $iMask)
$oShellApp.GetAppInfoData($pAppInfoData)
ReDim $aArray[$iF][UBound($aMax)]
For $i = 0 To UBound($aMax) - 1
$tData = DllStructCreate("wchar[260]", DllStructGetData($AppInfoData, $aMax[$i] + 2))
$sData = DllStructGetData($tData, 1)
If $aMax[$i] = 13 Then $sData = StringMid($sData, 7, 2) & "/" & StringMid($sData, 5, 2) & "/" & StringMid($sData, 1, 4)
$aArray[$iF - 1][$i] = ($sData = "0") ? "" : $sData
DllStructSetData($tData, 1, "")
Next
$oShellApp = Null
$iF += 1
WEnd
$oEnumInstalledApps = Null
Return $aArray
EndFunc ;==>GetInstalledApps
Func nCol($iMask)
Local $aFlag[18] = [$AIM_DISPLAYNAME, $AIM_VERSION, $AIM_PUBLISHER, $AIM_PRODUCTID, $AIM_REGISTEREDOWNER, $AIM_REGISTEREDCOMPANY, _
$AIM_LANGUAGE, $AIM_SUPPORTURL, $AIM_SUPPORTTELEPHONE, $AIM_HELPLINK, $AIM_INSTALLLOCATION, $AIM_INSTALLSOURCE, _
$AIM_INSTALLDATE, $AIM_CONTACT, $AIM_COMMENTS, $AIM_IMAGE, $AIM_READMEURL, $AIM_UPDATEINFOURL]
Local $iCol = 0
Local $x = 0
Local $aCol[18]
For $i = 0 To UBound($aFlag) - 1
If BitAND($iMask, $aFlag[$i]) Then
$aCol[$x] = $i + 1
$x += 1
EndIf
Next
ReDim $aCol[$x]
Return $aCol
EndFunc ;==>nCol
Saludos