Opened 11 years ago
Closed 11 years ago
#2410 closed Feature Request (Fixed)
Obj/COM Reference - PROPOSAL
Reported by: | mlipok | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.9.21 | Component: | Documentation |
Version: | Severity: | None | |
Keywords: | Cc: |
Description
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
Attachments (0)
Change History (3)
comment:1 Changed 11 years ago by TicketCleanup
- Version 3.3.9.18 deleted
comment:2 Changed 11 years ago by mlipok
Explanation for example:
I think that the examples are often used code fragments in programs that are written for all developers, but especially for novices.
I think it would be good if the example was quite complementary, as I suggested in this case.
comment:3 Changed 11 years ago by Jpm
- Milestone set to 3.3.9.21
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [8985] in version: 3.3.9.21
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Automatic ticket cleanup.