During the initialization of the add-in object, the pointer to 1C:Enterprise interface is passed to it. You can use the pointer to call the methods listed in this section. Note that these methods will not work at 1C:Enterprise server side.
AddError
Description:
Adds a message that can be displayed during the execution of 1C:Enterprise script extension methods. If the scode is not equal to 0, an exception is generated. You can catch and handle the exception using 1C:Enterprise script.
Possible message codes and 1C:Enterprise behavior are described in section Notification messages about object states.
Syntax:
bool AddError(unsigned short wcode, const WCHAR_T* source, const WCHAR_T* descr, long scode);
Parameters:
wcode
Type: unsigned short. Message code.
source
Type: const WCHAR_T*. Error source.
descr
Type: const WCHAR_T*. Error message.
scode
Type: long. Error code.
Return value:
- true - error details are successfully added.
-
false - errors occurred.
RegisterProfileAs
Description:
Registers the list of add-in parameters with name wsProfileName.
Syntax:
bool RegisterProfileAs(WCHAR_T* wsProfileName);
Parameters:
wsProfileName
Type: WCHAR_T*. Name of the add-in parameter list.
Return value:
- true - successful completion.
-
false - errors occurred.
Read
Description:
Reads the add-in parameter value stored in pszPropName. If the value cannot be read and errDescriptor value is not NULL, 1C:Enterprise allocates memory and writes the error description to that memory. The add-in must release the memory by calling FreeMemory(). For return values of string type, 1C:Enterprise also allocates memory and saves the address in the corresponding field of the tVariant structure. The add-in must release that memory by calling FreeMemory().
Syntax:
bool Read(WCHAR_T* pszPropName, tVariant* pVal, long* pErrCode, WCHAR_T** errDescriptor);
Parameters:
pszPropName
Type: WCHAR_T*. Parameter name.
pVal
Type: tVariant*. Pointer to the parameter value.
pErrCode
Type: long*. Pointer to the variable that will store the error code if an error occurs.
errDescriptor
Type: WCHAR_T**. Double pointer to the variable that will store the error description.
Return value:
- true - successful completion.
-
false - errors occurred.
Write
Description:
Saves the add-in parameter value to pszPropName.
Syntax:
bool Write(WCHAR_T* pszPropName, tVariant* pVar);
Parameters:
pszPropName
Type: WCHAR_T*. Parameter name.
pVar
Type: tVariant*. Pointer to the parameter value.
Return value:
- true - successful completion.
-
false - errors occurred.
SetEventBufferDepth
Description:
Sets the event queue size for the specified object. If the number of events exceeds the specified queue size, the latest events are deleted.
Syntax:
bool SetEventBufferDepth(long lDepth);
Parameters:
lDepth
Type: long. Event queue size.
Return value:
- true - successful completion (the size is set).
-
false - errors occurred.
GetEventBufferDepth
Description:
Returns the event queue size for the specified object.
Syntax:
long GetEventBufferDepth();
Return value:
Event queue size.
ExternalEvent
Description:
Adds the event (its source, name, and parameters) to the queue. During the event processing, that data is passed to the ExternalEventProcessing() procedure. When the ExternalEvent() method is called, further event processing is performed as follows: the event is added to the queue (if the queue is full, the event is lost), then, if no system events are available and the queue is not empty, external event processing is started for the first event in the queue. This process is repeated for all add-in objects. This synchronizes external event processing with system event processing.
Syntax:
bool ExternalEvent(WCHAR_T* wsSource, WCHAR_T* wsMessage, WCHAR_T* wsData);
Parameters:
wsSource
Type: WCHAR_T*. String that stores the event source name
wsMessage
Type: WCHAR_T*. String that stores the event name.
wsData
Type: WCHAR_T*. String that stores the event parameters.
Return value:
- true - event is added to the queue.
-
false - the queue is full, event processing is not available, or an unknown error occurred.
CleanEventBuffer
Description:
Clears the event queue by deleting all events from it.
Syntax:
void CleanEventBuffer();
Return value:
None.
SetStatusLine
Description:
Sets the status bar text (displayed at the bottom part of the 1C:Enterprise window).
Syntax:
bool SetStatusLine(WCHAR_T* wsStatusLine);
Parameters:
wsStatusLine
Type: WCHAR_T*. Status bar text.
Return value:
- true - the text is displayed in the status bar.
-
false - this functionality is not available, or an unknown error occurred.
ResetStatusLine
Description:
Clears the status bar.
Syntax:
void ResetStatusLine();
Return value:
None.
GetInterface
Description:
Requests the platform interface.
Syntax:
IInterface* GetInterface(Interfaces iface)
Parameters:
iface
Type: Interfaces. The value of the Interfaces enumeration: eIMsgBox or eIPlatformInfo.
Return value:
- IInterface* - pointer to the requested interface.
-
0 - the requested interface is not supported by the platform.
Confirm
Description:
Displays a dialog box with text specified in queryText and buttons OK and Cancel.
Syntax:
bool Confirm(const WCHAR_T* queryText, tVariant* retVal)
Parameters:
queryText
Type: WCHAR_T*. Question text.
retVal
Type: tVariant*. Return value of the dialog box, which has VTYPE_BOOL type: true for clicking OK, or false for clicking Cancel.
Return value:
- true - the dialog box is displayed.
-
false - the dialog box is not displayed.
Alert
Description:
Displays a simple notification dialog box with text specified in text and OK button.
Syntax:
bool Alert(const WCHAR_T* text)
Parameters:
text
Type: WCHAR_T*. Message text.
Return value:
- true - the dialog box is displayed.
-
false - the dialog box is not displayed.
GetPlatformInfo
Description:
Requests platform info. If the add-in is attached to 1C:Enterprise version earlier than 8.3.3 using a web client, only the Application field of the AppInfo structure is filled.Syntax:
AppInfo* GetPlatformInfo()
Return value:
-
AppInfo* - pointer to a structure with the following fields:
-
AppVersion. Type: WCHAR_T*, application version.
-
Application. Type: enumeration, type of application that attached the add-in.
-
UserAgentInformation. Type: WCHAR_T*, browser info (for the web client only).