KVHTMLStartOOPSession()
This function performs the following:
-
Initializes the out-of-process session.
-
Specifies the input stream or file.
-
Passes conversion options from the
KVHTMLTemplateEx,KVHTMLOptionsEx, andKVHTMLTOCOptionsdata structures. -
Creates a Servant process.
-
Establishes a communication channel between the application thread and the Servant.
-
Sends the data to the Servant.
Syntax
BOOL pascal KVHTMLStartOOPSession( void *pContext, KVInputStream *pInputStream, char *pFileName, KVHTMLTemplateEx *pTemplatesEx, KVHTMLOptionsEx *pOptionsEx, KVHTMLTOCOptions *pTOCCreateOptions DWORD *pPID, KVErrorCode *pError DWORD dwOptions, void *pReserved1, void *pReserved2 );
Arguments
|
|
A pointer returned from fpInit() or fpInitWithLicenseData(). |
|
|
A pointer to the developer-assigned instance of If |
|
|
A pointer to the file to be converted. The file must exist on the same file system as the Servant. If |
|
|
A pointer to the If this pointer is |
|
|
A pointer to the If this pointer is |
|
|
A pointer to the If this pointer is |
|
|
Address of a |
|
|
A pointer to an error code defined in |
|
|
Reserved for future use. |
|
|
Reserved for future use. |
|
|
Reserved for future use. |
Returns
If the call is successful, the return value is TRUE.
If the call is unsuccessful, the return value is FALSE.
Discussion
- After the out-of-process session is started successfully, all conversion functions can be called. The data is then processed on the Servant until the session is terminated by a call to
KVHTMLEndOOPSession(). - All functions that can run out of process must be called within the out-of-process session, that is, after the call to
KVHTMLStartOOPSession(), and before the call toKVHTMLEndOOPSession(). - The
KVHTMLConvertFile()function can only be called once in a single out-of-process session. - Since the
KVHTMLTemplateEx,KVHTMLOptionsEx, andKVHTMLTOCOptionsdata structures are passed by this function, the same pointers in the call toKVHTMLConvertFile()are ignored. -
On Windows,
pFileNamemust be in the local Windows code page.
Example
The following sample code is from the cnv2htmloop sample program:
/* declare OOP startsession function pointer */
BOOL (pascal *fpKVHTMLStartOOPSession)( void *,
KVInputStream *,
char *,
KVHTMLTemplateEx *,
KVHTMLOptionsEx *,
KVHTMLTOCOptions *,
DWORD *,
KVErrorCode *,
DWORD ,
void *,
void * );
/* assign OOP startsession function pointer */
fpKVHTMLStartOOPSession = (BOOL (pascal *)( void *,
KVInputStream *,
char *,
KVHTMLTemplateEx *,
KVHTMLOptionsEx *,
KVHTMLTOCOptions *,
DWORD *,
KVErrorCode *,
DWORD ,
void *,
void * ))mpGetProcAddress(hKVHTML, "KVHTMLStartOOPSession");
if(!fpKVHTMLStartOOPSession)
{
printf("Error assigning KVHTMLStartOOPSession() pointer\n");
(*KVHTMLInt.fpFileToInputStreamFree)(pKVHTML, &Input);
(*KVHTMLInt.fpFileToOutputStreamFree)(pKVHTML, &Output);
mpFreeLibrary(hKVHTML);
return 7;
}
/********START OOP SESSION *****************/
if(!(*fpKVHTMLStartOOPSession)(pKVHTML,
&Input,
NULL,
&HTMLTemplates, /* Markup and related variables */
&HTMLOptions, /* Options */
NULL, /* TOC options */
&oopServantPID,
&error,
0,
NULL,
NULL))
{
printf("Error calling fpKVHTMLStartOOPSession \n");
(*KVHTMLInt.fpFileToInputStreamFree)(pKVHTML, &Input);
(*KVHTMLInt.fpFileToOutputStreamFree)(pKVHTML, &Output);
(*KVHTMLInt.fpShutDown)(pKVHTML);
mpFreeLibrary(hKVHTML);
return 9;
}