Printing using ExtEscape

pogressuser

New Member
Hello,

Does anyone know why the following api give an error (87 - The parameter is incorrect) with some printer drivers and work with some?

RUN ExtEscape(opiPrinterDC, /* printer handle obtained from CreateDCA procedure */
19, /* passthrough */
GET-SIZE(mBuffer) - 1,
GET-POINTER-VALUE(mBuffer),
0,
OUTPUT cNull,
OUTPUT siReturn).

/*** ORIGINAL API DEFINITION FROM MS ******/


int ExtEscape( __in HDC hdc, __in int nEscape, __in int cbInput, __in LPCSTR lpszInData, __in int cbOutput, __out LPSTR lpszOutData);/************************************/


Sample Code from Progress...

PROCEDURE ExtEscape EXTERNAL "gdi32" :
DEFINE INPUT PARAMETER hdc AS LONG NO-UNDO.
DEFINE INPUT PARAMETER nEscape AS LONG NO-UNDO.
DEFINE INPUT PARAMETER cbInput AS LONG NO-UNDO.
DEFINE INPUT PARAMETER lpszInData AS LONG NO-UNDO.
DEFINE INPUT PARAMETER cbOutput AS LONG NO-UNDO.
DEFINE OUTPUT PARAMETER lpszOutData AS CHAR NO-UNDO.
DEFINE RETURN PARAMETER ReturnValue AS LONG NO-UNDO.
END PROCEDURE.

RUN CreateDCA ("WINSPOOL",
scPrinterName,
0,
GET-POINTER-VALUE(mDevMode),
OUTPUT opiPrinterDC).


/** Printer handle is valid at this time
Memory buffer logic and assignment */

RUN ExtEscape(opiPrinterDC,
19,
GET-SIZE(mBuffer) - 1,
GET-POINTER-VALUE(mBuffer),
0,
OUTPUT cNull,
OUTPUT siReturn).

Returns -1. When Checked with GetLastError API the real error is 87 - The parameter is incorrect. It works fine with some printer drivers but does not with some (in case of MICR printer) drivers.

Any help will be appreciated!
 
Back
Top