# EssGetActive

Description

EssGetActive() gets the names of the caller's current active application and database.

Syntax

    ESS_FUNC_M EssGetActive (hCtx, pAppName, pDbName, pAccess);

ESS_HCTX_T | hCtx
ESS_PSTR_T | pAppName
ESS_PSTR_T | pDbName
ESS_PACCESS_T | pAccess;

Parameters

hCtx | Essbase API context handle.
pAppName | Address of pointer to receive allocated application name string.
pDbName | Address of pointer to receive allocated database name string.
pAccess | Address of variable to receive the user's access level to the selected database. See Bitmask Data Types for a list of possible values for this field.

Return Value

If successful, returns the user's selected active application and database in pAppName and pDbName.

Notes

- You should free the memory allocated for pAppName and pDbName using EssFree().

Access

This function requires no special privileges.

Example

    ESS_FUNC_M
    ESS_GetAppActive (ESS_HCTX_T       hCtx,
                     ESS_HINST_T      hInst
                    )
    {
       ESS_FUNC_M     sts = ESS_STS_NOERR;
       ESS_STR_T     pDbName;
       ESS_STR_T     pAppName;
       ESS_ACCESS_T  Access;
       if ((sts = EssAlloc (hInst, 80,
           (ESS_PPVOID_T)&pAppName)) == 0)
       {
          if ((sts = EssAlloc (hInst, 80,
              (ESS_PPVOID_T)&pDbName)) == 0)
          {
             if ((sts = EssGetActive (hCtx, &pAppName,
                  &pDbName, &Access)) == 0)
             {
                if (pAppName)
                {
                   if (*pAppName)
                      printf ("Current active application is [%s]\r\n",pAppName);
                   else
                      printf ("No active Application is set\r\n");
                   printf ("\r\n");
                }
             }
             EssFree (hInst, pDbName);
          }
          EssFree (hInst, pAppName);
       }
       return (sts);
    }

See Also

EssClearActive()
EssSetActive()