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.

Init

Description:

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.

Syntax:

HRESULT Init(IDispatch* pBackConnection);

Parameters:

pBackConnection

Type: IDispatch*. Pointer to 1C:Enterprise interface.

Return value:

  • E_FAIL - errors occurred.
  • S_OK - successful initialization.

Done

Description:

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).

Syntax:

HRESULT Done(void);

Return value:

  • S_OK - the object operation is complete.

GetInfo

Description:

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.

Syntax:

HRESULT GetInfo(SAFEARRAY** pInfo);

Parameters:

pInfo

Type: SAFEARRAY**. Double pointer to the VARIANT structures array. 1C:Enterprise will allocate memory for the array.

Return value:

  • S_OK - add-in details are returned.


Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.