#define ENUMPAPERMETRICS 34 |
short Control(lpDevice, ENUMPAPERMETRICS, lpInData, lpOutData) | |||
LPPDEVICE lpDevice; | |||
LPINT lpInData; | |||
LPRECT lpOutData; |
The ENUMPAPERMETRICS escape either retrieves the number of paper types supported by the driver, or fills an array of RECT structures with the dimensions of each paper type.
The ExtDeviceMode function achieves the same results.
lpDevice
Points to a PDEVICE structure specifying the destination device.
lpInData
Points to an 16-bit variable that specifies what action to take. If the variable is zero, the escape returns the number of paper types. If zero, the escape fills an array of RECT structures with paper dimensions.
lpOutData
Points to an array of RECT structures that receive the coordinates of the imageable area of the page. The top-left corner of the rectangle specifies the page margins, and the bottom-right corner specifies the sum of the page margins and the width and height of the imageable area. The units are device coordinates. The orientation returned is always portrait.
The return value is positive, if successful. Otherwise, it is zero if the escape is not implemented, and negative if an error occurs.
The following example illustrates the required actions:
#define ENUMPAPERMETRICS 34
#define INFORM 0
#define PERFORM 1
int cPaperTypes = CPAPERTYPES;
RECT arectPage[CPAPERTYPES] = { ... };
short Control(lpDevice, wFunction, lpInData, lpOutData)
LPPDEVICE lpDevice;
WORD wFunction;
LPVOID lpInData;
LPVOID lpOutData;
{
LPRECT arect;
switch (wFunction) {
case ENUMPAPERMETRICS:
switch (*((LPINT)lpInData)) {
case INFORM:
return cPaperTypes;
case PERFORM:
arect = (LPRECT)lpOutData;
for (i=0; i<cPaperTypes; arect++, i++)
CopyRect(arect, arectPage[i]);
return cPaperTypes;
default:
return 0;
}
.
.
.
}