AutoHotkey_COM: COM Error handling through
ComError object is added.
Code:
ComObjConnect("ComError" [, function_name])
1) Omitting or passing non-existent/invalid function name will turn
off the error handling, otherwise, turn it
on. It's defaultly
off.
2) The function should have
one parameter which will be assigned to the
ComError object containing the information about an error. Although the error handling will assign only the first parameter, currently it'll not reject the function with more than one parameters as this function can be of multi-purpose.
3) The ComError object has the following properties: name, number, message, source, description, helpfile, helpcontext
See the example of the usage in the below. For those members who don't want to write his own error handling function, I also included in the zip
ComError.ahk which is supposed to be used as a standard library.
ComError()/ComError("") will turn the error notification
on/off.
Code:
ComObjConnect("ComError", "ErrMsg")
...
ErrMsg(err)
{
MsgBox 0, COM Error, % "Name:`t" err.Name "`n" err.Number ":`t" err.Message "`nSource:`t" err.Source "`nDescription:`t" err.Description "`nHelp:`t" err.HelpFile "," err.HelpContext
}