Escape function

The Escape function enables an application to access the system-defined device capabilities that are not available through GDI. Escape calls made by an application are translated and sent to the driver.

Syntax


int Escape(
  _In_   HDC hdc,
  _In_   int nEscape,
  _In_   int cbInput,
  _In_   LPCSTR lpvInData,
  _Out_  LPVOID lpvOutData
);

Parameters

hdc [in]

A handle to the device context.

nEscape [in]

The escape function to be performed. This parameter must be one of the predefined escape values listed in Remarks. Use the ExtEscape function if your application defines a private escape value.

cbInput [in]

The number of bytes of data pointed to by the lpvInData parameter. This can be 0.

lpvInData [in]

A pointer to the input structure required for the specified escape.

lpvOutData [out]

A pointer to the structure that receives output from this escape. This parameter should be NULL if no data is returned.

Return value

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 a system error code.

Errors

If the function fails, the return value is one of the following values.

ValueMeaning

SP_ERROR

General error.

If SP_ERROR is returned, Escape may set the last error code to:

  • ERROR_DISK_FULL
  • ERROR_INVALID_PARAMETER
  • ERROR_NOT_ENOUGH_MEMORY
  • ERROR_PRINT_CANCELLED

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 Print Manager.

 

Remarks

Note  This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation—factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

The effect of passing 0 for cbInput will depend on the value of nEscape and on the driver that is handling the escape.

Of the original printer escapes, only the following can be used.

EscapeDescription

QUERYESCSUPPORT

Determines whether a particular escape is implemented by the device driver.

PASSTHROUGH

Allows the application to send data directly to a printer.

 

Use the StartPage function to prepare the printer driver to receive data.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Printing
Print Spooler API Functions
AbortDoc
DocumentProperties
EndDoc
EndPage
ExtEscape
GetDeviceCaps
PrinterProperties
SetAbortProc
StartDoc
StartPage
ResetDC

 

 

Community Additions

ADD
Show:
© 2014 Microsoft