## Printer Device Driver

[prev][next][parent][TOC]

### GplJournalCreateInstance

Description

This function will create a reusable instance for a particular DC. The opposite of this function is GplJournalDeleteInstance. Following are the four cases in which this function may be called:

Case 1 Ask for the number of bytes to allocate for the handle.

Case 2 DEVESC_STARTDOC time is the first (real) time this function is called. hJournal has been allocated. Initialize hJournal's bytes to 0.

Case 3 At DEVESC_NEWFRAME time, another page, more processing. After the call to GplJournalPlayInstance has completed, set it up for the next page.

Case 4 At DEVESC_NEWFRAME time, another page, but this time we want the information about the page to change. The call to GplJournalPlayInstance has completed.

Format

    APIRET APIENTRY GplJournalCreateInstance( HJOURNAL   hJournal,    // Journal handle

                                              PIJOURNAL  pIJournal,   // Journal data structure

                                              ULONG      ulFlags );   // Creation flags (defaults)

Parameters

hJournal (HJOURNAL) Handle to the journal file instance.

pIJournal (PIJOURNAL) A pointer to the input structure.

ulFlags (ULONG) This function performs different actions based on the ulFlags. The ulFlags is a bit vector (individual bits have different meanings). The options are separated into mutually exclusive groups that must have one member set.

CREATE_DRAW_WHILE_RECORDING Turn on drawing while the journal file is being recorded.

Returns

Success TRUE
Failure FALSE

Implementation

This function will perform different actions based on the input parameters:

Case 1

The function will return the size (in the number of bytes) of a handle. It is the responsibility of the of caller to allocate and free the memory for a journal handle.

hJournal NULL.
pIJournal NULL.

Case 2

This function creates an engine journal file and starts recording to it. It also starts the accumulation of bounds. Call GplJournalPlayInstance to stop recording and play the journal file.

hJournal Address of newly allocated memory.

pIJournal Address of the input structure. The structure has following format:

ulSize Size of this structure.

hModule Module handle of the calling program.

hdc Current HDC.

usXLength Page size in pels.

usYLength Page size in pels.

bPortrait Orientation of page.
TRUE-portrait
FALSE-landscape

usBandLength Band height in pels.

pfunBand Pointer to a callback function with the following prototype. This function is only called at the end of each band. (_System *)(PVOID, PRECTL)

pfunArg Any pointer. This will be passed to the first parameter of the previous callback function.

Flags Contains creation flags.

Case 3

The function performs the same functionality as Case 2. However, you can change any of the parameters in the input structure from the previous call to GplJournalCreateInstance.

hJournal Handle to a journal file instance.

pIJournal Address of the input structure. The structure has following format:

ulSize Size of this structure.

hModule Module handle of the calling program.

hdc Current HDC.

usXLength Page size in pels.

usYLength Page size in pels.

bPortrait Orientation of page.
TRUE-portrait
FALSE-landscape

Case 4

For this case, a new page has been sent and you will restart the entire process (Case 2). This function uses the same parameters that were given to the original call to GplJournalCreateInstance.

hJournal Handle to a journal file instance.
pIJournal NULL.