<< Back


FVSDK_InitSession

Synopsis

FVSDK_ERROR_CODE FVSDK_InitSession(FVSDK_Session* pSession, BOOL bDynamic);

Description

Initializes an FVSDK_Session structure with the defaults and establishes internal data to manage sessions. Use this function instead of FVSDK_NewSession() when using a session structure already allocated on the heap or the stack.

When finished with a session object initialized with FVSDK_InitSession(), be sure to call FVSDK_CloseSession() to release all internal data associated with this session.

Parameters

pSession

A pointer to the FVSDK_Session to initialize.

bDynamic

Set to TRUE if the structure is allocated dynamically, FALSE if not. This element is only used when the DLL unloads and recognizes proper session shutdown has not occurred (when FVSDK_CloseSession() or FVSDK_FreeSession() is not called on any given FVSDK_Session). Set to TRUE ONLY if you want FVSDK to delete the session pointer (pSession) passed here. Generally, if this function is called by your application, you will never set this parameter to TRUE.

Return Value

FVSDK_OK if the session was successfully initialized; error codes can be found in FVSDK_ErrorCodes.h.

Example

// create the session structure
FVSDK_Session Session;

// initialize the structure
Session.nVersion = FVSDK_SESSION_CURRENT_VERSION;
Session.nSize    = sizeof(Session);

// initialize the session in the SDK
if (FVSDK_InitSession(&Session, FALSE) == FVSDK_OK) {

    // ... do some work

    // close the session
    if (FVSDK_CloseSession(&Session) != FVSDK_OK)
        AfxMessageBox("Unable to close the session");
} // if
else
    AfxMessageBox("Unable to initialize the session.");