Gets the API login context handle for the specified grid.
Syntax
ESSG_FUNC_M EssGGetAPIContext (hGrid, pEssHctx);
| Parameter | Data Type | Description |
|---|---|---|
hGrid | ESSG_HGRID_T | Handle passed back from EssGNewGrid. |
pEssHctx | ESSG_PPVOID_T | Variable for the return of the API context handle of the connected grid. |
Notes
This allows the caller to call non-Grid API functions that require a login context handle.
If there is no valid connection to the server, there is no valid API context handle and the call will fail and set *pEssHctx to ESS_INVALID_HCTX.
Do not use the returned login context in API functions that would change the context information.
Return Value
If successful, returns ESSG_STS_NOERR.
Example
#include <essapin.h>
#include <essgapin.h>
ESSG_FUNC_M sts = ESS_STS_NOERR;
ESSG_INIT_T InitStruct;
ESSG_HANDLE_T Handle;
ESSG_PVOID_T EssHctx;
ESSG_HGRID_T hGrid;
InitStruct.ulVersion = ESSG_VERSION;
InitStruct.ulMaxRows = 1000;
InitStruct.ulMaxColumns = 200;
InitStruct.pfnMessageFunc = ESS_NULL;
InitStruct.pUserdata = ESS_NULL;
/* initializes EGAPI */
sts = EssGInit(&InitStruct, Handle);
if(!sts)
sts = EssGNewGrid(Handle, &hGrid);
/* connect the grid to a database on the server */
if(!sts)
sts = EssGConnect(hGrid, "Rainbow", "Admin",
"Password", "Demo",
"Basic", ESSG_CONNECT_DEFAULT);
/* Get API context handle for the specified grid */
if(!sts)
sts = EssGGetAPIContext(hGrid, &EssHctx);
}See Also