The following information is provided as is, and the authors take no responsibility for the correctness.
The OPENCHANNEL escape will prevent the PostScript language printer driver from downloading a PostScript language header to the printer. NOTE: In Windows NT, the OPENCHANNEL escape is mapped to the StartDoc function call.
Sample 4 (pseudo code)
// 1) Use the sample code in Sample 1 to check for PostScript capabilities
// 2) Use the pseudo code in Sample 2 to ensure default GDI coordinates in Windows NT3.1.
// Initialize flag
int Escape_Supported=FALSE;
char retstr[128];
// check for OPENCHANNEL support
if (Escape(..., QUERYESCSUPPORT, ...,OPENCHANNEL, ...) {
// OPENCHANNEL escape is supported
Escape_Supported=TRUE;
Escape(..., OPENCHANNEL, ..., ..., &retstr);
}
if (Escape_Supported) {
#ifndef WINDOWSNT
// Start print job here. This call is redundant in Windows NT
StartDoc();
#endif
// Now do your PASSTHROUGH stuff here
Escape(..., PASSTHROUGH, ..., ..., ...);
EndDoc();
} else {
// escape not supported, call your alternate routine here
}
As explained in Sample 1 and Sample 2, you will need to check for PostScript language capabilities and set your printer coordinates to the default GDI coordinates (for Windows NT 3.1 only) before proceeding to other printer escapes. The pseudo logic in Sample 4 will set the Escape_Supported flag to TRUE if the QUERYESCSUPPORT escape confirms a supported OPENCHANNEL escape. Using this flag, you can determine if you can proceed along a PostScript language printing path or go through an alternate printing route. Note: you will use the compiler define switches to determine if you will be using the non-Windows NT pseudo logic, in other words, you will not need to call the StartDoc() function under Windows NT.
The Sample 1 code described in this article has been tested on Windows 3.1, Windows For Workgroups 3.1, Windows 95, Windows NT 3.5. The other pseudo-code provided here is intended as a guideline and is by no means a complete solution.solution.