Notification messages about object states
An object can use the IErrorLog interface for generating user notifications. It is a standard COM interface, the description of the AddError() method is provided here only for convenience. New notifications are processed at run time (if they are queued asynchronously), on returning from the Init() method, and on returning from add-in methods. All messages are queued and processed in the order they were added. The number of stored messages is not limited.
Adds a notification message from a 1C:Enterprise script extension method.
Possible message codes:
#define ADDIN_E_NONE 1000
#define ADDIN_E_ORDINARY 1001
#define ADDIN_E_ATTENTION 1002
#define ADDIN_E_IMPORTANT 1003
#define ADDIN_E_VERY_IMPORTANT 1004
#define ADDIN_E_INFO 1005
#define ADDIN_E_FAIL 1006
#define ADDIN_E_MSGBOX_ATTENTION 1007
#define ADDIN_E_MSGBOX_INFO 1008
#define ADDIN_E_MSGBOX_FAIL 1009
The message code is stored to the wCode field of the EXEPINFO structure. Error codes in range 1000 - 2000 are reserved.
During the notification processing, warning dialog boxes are displayed for notifications with the following codes: ADDIN_E_MSGBOX_ATTENTION, ADDIN_E_MSGBOX_INFO, and ADDIN_E_MSGBOX_FAIL. For the rest of the codes, notifications are displayed in the message window. Notification descriptions have the following format:
<Icon> <ErrorSource> : <ErrorDescription> (Error code = <ErrorCode>)
The following icons are available:
- ADDIN_E_NONE. No icon
ADDIN_E_ORDINARY. ">" icon
ADDIN_E_ATTENTION. "!" icon
ADDIN_E_IMPORTANT. "!!" icon
ADDIN_E_VERY_IMPORTANT. "!!!" icon
ADDIN_E_INFO. "i" icon
ADDIN_E_FAIL. "!!!" icon
If an icon code is not found in the list, no icon is displayed.
ErrorSource - the bstrSource field in the EXCEPINFO structure.
ErrorDescription - the bstrDescription field in the EXCEPINFO structure.
ErrorCode - numeric message code in a decimal form. The message code is not displayed if one of the codes listed above is used.
For notifications with codes ADDIN_E_MSGBOX_ATTENTION, ADDIN_E_MSGBOX_INFO, or ADDIN_E_MSGBOX_FAIL, a dialog box is displayed, which contains the OK button and the icon MB_ICONEXCLAMATION, MB_ICONINFORMATION, or MB_ICONERROR respectively.
Notification descriptions have the following format:
<ErrorSource>:<ErrorDescription> (Error code = <ErrorCode>)
where ErrorSource, ErrorDescription, and ErrorCode are described above.
HRESULT AddError(BSTR pszPropName, LPEXCEPINFO pExcepInfo);
Type: BSTR. In this implementation, the pszPropName parameter is ignored.
Type: LPEXCEPINFO. Pointer to the EXCEPINFO structure.
S_OK - the message is successfully added.
E_OUTOFMEMORY - not enough memory.
Other return codes that inform about errors are possible.