$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$objClass = ObjGet("WinMgmts:\\.\root\cimv2:Win32_Product")
$colSoftware = $objClass.Instances_
$strResult=''
For $objSoftware in $colSoftware
$strResult = $strResult & _
" Name: " & $objSoftware.Name & @crlf & _
@tab & "Caption: " & $objSoftware.Caption & @crlf & _
@tab & "Description: " & $objSoftware.Description & @crlf & _
@tab & "IdentifyingNumber: " & $objSoftware.IdentifyingNumber & _
@crlf & _
@tab & "InstallLocation: " & $objSoftware.InstallLocation & @crlf _
& @tab & "InstallState: " & $objSoftware.InstallState & @crlf & _
@tab & "PackageCache: " & $objSoftware.PackageCache & @crlf & _
@tab & "SKUNumber: " & $objSoftware.SKUNumber & @crlf & _
@tab & "Vendor: " & $objSoftware.Vendor & @crlf & _
@tab & "Version: " & $objSoftware.Version & @crlf & @crlf
Next
FileWrite(@ScriptDir&'\123',$strResult)
$oMyError = 0
Func MyErrFunc()
MsgBox(4096, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & hex($oMyError.number, 8) & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext)
Exit 1
EndFunc ;==>MyErrFunc