The Escape function allows applications to access capabilities of a particular device not directly available through GDI. Escape calls made by an application are translated and sent to the driver.
int Escape(
HDC hdc, |
// handle to device context |
int nEscape, |
// escape function |
int cbInput, |
// number of bytes in input structure |
LPCSTR lpvInData, |
// pointer to input structure |
LPVOID lpvOutData |
// pointer to output structure |
); |
If the function succeeds, the return value is greater than zero, except with the QUERYESCSUPPORT printer escape, which checks for implementation only. If the escape is not implemented, the return value is zero.
If the function fails, the return value is an error. To get extended error information, call GetLastError.
If the function fails, the return value is one of the following values.
Value |
Meaning |
SP_ERROR |
General error. If SP_ERROR is returned, Escape may set the last error code to:
ERROR_INVALID_PARAMETER |
SP_OUTOFDISK |
Not enough disk space is currently available for spooling, and no more space will become available. |
SP_OUTOFMEMORY |
Not enough memory is available for spooling. |
SP_USERABORT |
The user terminated the job through Windows Print Manager. |
The Win32 API provides six new functions that supersede some printer escapes:
Function |
Description |
Terminates a print job. Supersedes the ABORTDOC escape. | |
Ends a print job. Supersedes the ENDDOC escape. | |
Ends a page. Supersedes the NEWFRAME escape. Unlike NEWFRAME, this function is always called after printing a page. | |
Sets the abort function for a print job. Supersedes the SETABORTPROC escape. | |
Starts a print job. Supersedes the STARTDOC escape. | |
Prepares printer driver to receive data. |
The Win32 API provides six new indexes for the GetDeviceCaps function that supersede some printer escapes:
Index |
Description |
PHYSICALWIDTH |
For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. |
PHYSICALHEIGHT |
For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. |
PHYSICALOFFSETX |
For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the leftmost 0.25" of paper, has a horizontal physical offset of 150 device units. |
PHYSICALOFFSETY |
For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the topmost 0.5" of paper, has a vertical physical offset of 300 device units. |
Of the original printer escapes, only the following can be used by Win32-based application:
Escape |
Description |
QUERYYESCSUPPORT |
Determines whether a particular escape is implemented by the device driver. |
Following is a list of the obsolete printer escapes that are supported only for compatibility with 16-bit versions of Windows:
Escape |
Description |
ABORTDOC |
Stops the current print job and erases everything the application has written to the device since the last ENDDOC escape. |
ENDDOC |
Ends a print job started by the STARTDOC escape. |
GETPHYSPAGESIZE |
Retrieves the physical page size and copies it to the specified location. |
GETPRINTINGOFFSET |
Retrieves the offset from the upper-left corner of the physical page where the actual printing or drawing begins. |
GETSCALINGFACTOR |
Retrieves the scaling factors for the x-axis and the y-axis of a printer. |
NEWFRAME |
Informs the printer that the application has finished writing to a page. |
NEXTBAND |
Informs the printer that the application has finished writing to a band. |
PASSTHROUGH |
Allows the application to send data directly to a printer. |
SETABORTPROC |
Sets the Abort function for a print job. |
STARTDOC |
Informs a printer driver that a new print job is starting. |
AbortDoc, EndDoc, EndPage, ExtEscape, SetAbortProc, StartDoc, StartPage, ResetDC
file: /Techref/os/win/api/win32/func/src/f22_13.htm, 11KB, , updated: 2002/1/22 04:16, local time: 2024/11/15 21:23,
3.135.204.31:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/os/win/api/win32/func/src/f22_13.htm"> Escape</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.