fpInit()
This function initializes an Export session.
Syntax
KVErrorCode pascal _export fpInit( const char* pszKeyViewDir, const char* pszLicense, const char* pszIniFile, DWORD dWord, void** ppContext );
Arguments
|
A pointer to a string that contains the path of the KeyView Export directory (where the readers and the formats_e.ini file are located). This is normally the install\PLATFORM\bin directory. |
|
A pointer to a string that contains your license key, as provided by OpenText. Copy the key exactly, with no leading or trailing spaces. |
|
A pointer to a string that contains the full path of the KeyView Export configuration file, formats_e.ini . This file is normally stored in the directory install\PLATFORM\bin , where install is the path of the installation directory and PLATFORM is the name of the platform. |
|
Reserved. Must be 0. |
ppContext
|
A pointer to a context pointer for the session that you want to initialize. When you call fpInit() , the context pointer is set to the address of the new session context. |
Returns
The function returns an error code.
- When initialization is successful, the error code is
KVError_Success
and the session context is stored in*ppContext
. Use the*ppContext
context pointer in future calls to KeyView - it must be passed as the first argument to many of the File Extraction API and Export API functions. - When initialization is unsuccessful, the return value is an error code (see KVErrorCode for more information), and
*ppContext
is set toNULL
.
Discussion
-
If
pszKeyViewDir
isNULL
, the required components cannot be found. Ensure that it is valid. -
To ensure multi-threaded conversions are thread-safe, you must create a unique context pointer for every thread by calling
fpInit()
. In addition, threads must not share context pointers, and the same context pointer must be used for all API calls in the same thread. Creating a context pointer for every thread does not affect performance because the context pointer uses minimal resources. -
When the conversion context is no longer required, terminate it by calling fpShutDown().
-
On Windows,
pszKeyViewDir
andpszIniFile
must be in the local Windows code page.
Example
The following sample code is from the cnv2html
sample program:
error = (*KVHTMLInt.fpInit)(szDir, YOUR_KEYVIEW_LICENSE, NULL, 0, &pKVHTML); if (error != KVError_Success) { printf("Error initializing KVHTML: %d\n", error); mpFreeLibrary(hKVHTML); return 4; }