# EsbInit

Description

EsbInit() initializes the Essbase VB API and message database. The ESB_INIT_T structure passed to this function includes a number of initialization parameters, including the name of the message database, the flag indicating whether to use a customized error handler, the maximum message stack size to be used by this error handler, the name and location of your help file, and version number.

Syntax

    EsbInit (pInit, phInst)

    pInit  As ESB_INIT_T
    phInst As Long

Parameters

pInit | Pointer to Essbase VB API initialization structure.
phInst | Pointer to Essbase VB API instance handle.

Return Value

The ESB_INIT_T structure passed to this function includes a number of initialization parameters, including the name of the message database, error handler, the name and location of your help file, and version number.

EsbInit() returns an instance handle in phInst. The returned instance handle allows multiple applications to independently access the VB API (for DLLs only). The instance handle should be preserved and passed to the EsbLogin() and EsbTerm() functions.

Notes

- You must call this function before any other Essbase VB API functions.
- If any field in the initialization structure is an empty string or zero (as appropriate), the API uses a default value for those parameters.
- ESB_TRUE and ESB_FALSE are global variables. Assign them integer values as demonstrated in the example.

Access

This function requires no special access.

Example

    Declare Function EsbInit Lib "ESBAPIW.DLL" (Init As ESB_INIT_T, hInst As Long) As Long

    Sub ESB_Init ()
       Dim hInst As Long
       Dim Init As ESB_INIT_T
       Dim sts As Long

       ESB_FALSE = 0
       ESB_TRUE  = 1

       '**********************
       ' Define init structure
       '**********************
       Init.Version = ESB_API_VERSION
       Init.MaxHandles = 10
       Init.LocalPath = "C:\ESSBASE"
       ' Use default message file
       Init.MessageFile =""
       ' Use EsbGetMessage to retrieve
       ' messages
       Init.ClientError = ESB_TRUE
       Init.ErrorStack = 100

       '*******************
       ' Initialize the API
       '*******************
       sts = EsbInit (Init, hInst)
    End Sub

See Also

EsbLogin()
EsbAutoLogin()
EsbTerm()
EsbGetMessage()