Initializing and unloading add-ins
Use the IInitDone interface for initializing and unloading the add-in. The interface inherits from IUnknown. It is intended for initializing objects and finishing working with them.
During 1C:Enterprise startup, it initializes the add-in object by running the Init() method and passing the pointer to IDispatch to this method. The object can save the pointer for further use. The object can get all other 1C:Enterprise interfaces by calling the QueryInterface() method of the IDispatch interface passed to it. The object returns S_OK on successful initialization or E_FAIL if an error occurred. The method can use the IErrorLog interface for displaying error info. The initialization is considered unsuccessful if any of the passed EXCEPINFO structures has the scode field value not equal to S_OK. All data passed to IErrorLog and then returned is processed when the method execution is complete. When the method is called, the AppDispatch property is not defined.
HRESULT Init(IDispatch* pBackConnection);
Type: IDispatch*. Pointer to 1C:Enterprise interface.
- E_FAIL - errors occurred.
S_OK - successful initialization.
1C:Enterprise calls this method when it finishes working with the add-in object. The object must return S_OK. This method is called regardless of the object initialization result (the Init() method).
- S_OK - the object operation is complete.
1C:Enterprise calls this method to get add-in details. In add-in creation technology version 2.0, write the supported technology version to the element with index 0 in the V_I4 format. It is an integer with a major version number represented as thousands, and a minor version number represented as units. For example, version 1.0 should be passed as 1000. All add-in objects can support version 1.0 (number 1000) or version 2.0 (number 2000). 1C:Enterprise allocates memory for pInfo. The method must return S_OK.
The add-in object must implement this interface. If the interface is not available, the add-in cannot be loaded.
HRESULT GetInfo(SAFEARRAY** pInfo);
Type: SAFEARRAY**. Double pointer to the VARIANT structures array. 1C:Enterprise will allocate memory for the array.
S_OK - add-in details are returned.