EssGetActive

Gets the names of the caller's current active application and database.

Syntax

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

hCtx

ESS_HCTX_T

API context handle.

pAppName

ESS_PSTR_T

Address of pointer to receive allocated application name string.

pDbName

ESS_PSTR_T

Address of pointer to receive allocated database name string.

pAccess;

ESS_PACCESS_T

Address of variable to receive the user's access level to the selected database. See Bitmask Data Types (C) for a list of possible values for this field.

Notes

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

Return Value

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

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