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_ThCtx
ESS_PSTR_TpAppName
ESS_PSTR_TpDbName
ESS_PACCESS_TpAccess;

Parameters

hCtxEssbase API context handle.
pAppNameAddress of pointer to receive allocated application name string.
pDbNameAddress of pointer to receive allocated database name string.
pAccessAddress 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

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