DevEscape

This function allows applications to access facilities of a device not otherwise available through the API. Escapes are, in general, sent to the presentation driver and must be understood by it.

Syntax
DevEscape (hdc, lCode, lInCount, pbInData, plOutCount, pbOutData)

Parameter

 * hdc (HDC) - input:Device-context handle.
 * lCode (LONG) - input:Escape code.
 * If the device context is of type OD_QUEUED with a PM_Q_STD spool file, some escapes are sent to the presentation driver and others are recorded in the spool file (depending on the escape code). If the device context is of type OD_METAFILE, all escapes are metafiled. If the device context is of any type other than OD_QUEUED (with a PM_Q_STD spool file) or OD_METAFILE, all escapes are sent to the presentation driver.
 * The description for each standard escape specifies which of these categories the escape falls into.
 * Devices can define additional escape functions using user lCode values, that have the following ranges:
 * 32 768 through 40 959 Not metafiled and not recorded (sent to presentation driver for PM_Q_STD)
 * 40 960 through 49 151 Metafiled only (sent to presentation driver for PM_Q_STD)
 * 49 152 through 57 343 Metafiled and recorded (not sent to presentation driver) for PM_Q_STD
 * 57 344 through 65 535 Recorded only (not sent to presentation driver for PM_Q_STD).
 * The following escapes are defined:
 * DEVESC_QUERYESCSUPPORT
 * DEVESC_GETSCALINGFACTOR
 * DEVESC_STARTDOC
 * DEVESC_ENDDOC
 * DEVESC_ABORTDOC
 * DEVESC_NEWFRAME
 * DEVESC_RAWDATA
 * DEVESC_QUERYVIOCELLSIZES
 * DEVESC_SETMODE


 * lInCount (LONG) - input:Input data count.
 * Number of bytes of data in the pbInData buffer.


 * pbInData (PBYTE) - input:The input data required for this escape.
 * plOutCount (PLONG) - in/out:Output data count.
 * plOutCount is the number of bytes of data in the pbOutData buffer.
 * If data is returned in pbOutData, plOutCount is updated to the number of bytes of data returned.


 * pbOutData (PBYTE) - output:Output data.
 * pbOutData is a buffer that receives the output from this escape. If plOutCount is null, no data is returned.


 * lResult (LONG) - returns: Implementation error indicator:
 * DEVESC_ERROR Error
 * DEVESC_NOTIMPLEMENTED Escape not implemented for specified code
 * DEV_OK OK.

Remarks
The data fields for standard escapes are:

Errors
Possible returns from WinGetLastError
 * PMERR_INV_ESC_CODE (0x206D) - An invalid escape code was used in a call to DevEscape.
 * PMERR_INV_HDC (0x207C) - An invalid device-context handle or (micro presentation space) presentation-space handle was specified.
 * PMERR_INV_LENGTH_OR_COUNT (0x2092) - An invalid length or count parameter was specified.
 * PMERR_ESC_CODE_NOT_SUPPORTED (0x202B) - The code specified with DevEscape is not supported by the target device driver.
 * PMERR_INV_ESCAPE_DATA (0x206E) - An invalid data parameter was specified with DevEscape.

Related Functions

 * Prerequisite Functions: DevOpenDC


 * GpiAssociate (for DEVESC_STARTDOC)
 * GpiErase (for DEVESC_NEWFRAME)

Graphic Elements and Orders
DevEscape functions generate orders only when metafiling. Order: GEESCP

Example Code
This example uses DevEscape to access facilities of a device that would otherwise be unavailable through the normal Device API set. Here, a new page in a print job is started. 
 * 1) define INCL_DEV /* Device Function definitions  */
 * 2) include 

LONG lResult;    /* Error code or not implemented warning code */ HDC  hdc;        /* Device-context handle                */ LONG plOutCount; /* length of output buffer(input), number of bytes returned(output) */ PBYTE pbOutData; /* output buffer                        */

/* for the NEWFRAME, input and output buffers are not used, so set the buffer lengths to zero(0) and set the buffers to NULL */ plOutCount = 0; pbOutData = NULL;

lResult = DevEscape(hdc, DEVESC_NEWFRAME, 0L, NULL, &plOutCount,pbOutData); 