﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2410	Obj/COM Reference - PROPOSAL	mlipok	Jpm	"in ""Language Reference"" in ""Obj/COM Reference""

Please consider adding link to this function

""The main line in this script is: $EventObject='''ObjEvent'''($oIE,""IEEvent_"",...).""


""Error handling is implemented in the same way as a normal COM Event, using '''ObjEvent()''' and a user defined""

""This is the name to be used in an '''ObjCreate''', '''ObjGet''' or '''ObjEvent''' function.""



in ""COM Error Handling"" section

please consider to change an example:
now is:

{{{
Global $iEventError = 0 ; to be checked to know if com error occurs. Must be reset after handling.

$oMyError = ObjEvent(""AutoIt.Error"", ""ErrFunc"") ; Install a custom error handler

; Perform a deliberate failure (the object doesn't exist)
$oIE = ObjCreate(""InternetExplorer.Application"")
$oIE.visible = 1
$oIE.bogus
If $iEventError Then
    MsgBox(0, """", ""There was an error on the previous line."")
    $iEventError = 0 ; Reset after displaying a COM Error occurred
EndIf
Exit

; This is a custom error handler
Func ErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    MsgBox(0, """", ""We intercepted a COM Error !"" & @CRLF & _
            ""Number is: "" & $HexNumber & @CRLF & _
            ""WinDescription is: "" & $oMyError.windescription)
    $iEventError = 1 ; Use to check when a COM Error occurs
EndFunc   ;==>ErrFunc
}}}

Proposal:

{{{
#include <MsgBoxConstants.au3>
Global $iEventError = 0 ; to be checked to know if com error occurs. Must be reset after handling.

$oMyError = ObjEvent(""AutoIt.Error"", ""ErrFunc"") ; Install a custom error handler

; Perform a deliberate failure (the object doesn't exist)
$oIE = ObjCreate(""InternetExplorer.Application"")
$oIE.visible = 1
$oIE.bogus
If $iEventError Then
    MsgBox($MB_OK, """", ""There was an error on the previous line."")
    $iEventError = 0 ; Reset after displaying a COM Error occurred
EndIf
Exit

; This is a custom error handler
Func ErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    MsgBox($MB_OK, """", ""We intercepted a COM Error !"" & @CRLF & _
            ""Number is: "" & $HexNumber & @CRLF & _
            ""WinDescription is: "" & $oMyError.windescription & @CRLF & _
            ""source is: "" & $oMyError.source & @CRLF & _
            ""description is: "" & $oMyError.description & @CRLF & _
            ""helpfile is: "" & $oMyError.helpfile & @CRLF & _
            ""helpcontext is: "" & $oMyError.helpcontext & @CRLF & _
            ""lastdllerror is: "" & $oMyError.lastdllerror & @CRLF & _
            ""scriptline is: "" & $oMyError.scriptline & @CRLF & _
			"""" )
    $iEventError = 1 ; Use to check when a COM Error occurs
EndFunc   ;==>ErrFunc

}}}
"	Feature Request	closed	3.3.9.21	Documentation		None	Fixed		
