Microsoft KB Archive/64554

INF: Using the ExtDeviceMode Escape Sample Code

PSS ID Number: Q64554 Article last modified on 04-26-1993

3.00 WINDOWS

Summary: Printer drivers developed for Windows 3.0 should support the new ExtDeviceMode escape, which was added to Windows version 3.0. Most printer drivers support this function, but an application must check that support exists before calling it. ExtDeviceMode can only be used to change those selections supported by the current driver. For example, a printer driver might support the paper sizes letter, legal, and envelope. ExtDeviceMode can be used to change from letter to legal, but it cannot define a new paper size. There is a modified version of the Windows Software Development Kit (SDK) PRNTFILE example in a Software Library file named EXTDEV. This sample illustrates how to use ExtDeviceMode to select landscape paper orientation. EXTDEV can be found in the Software/Data Library by searching on the keyword EXTDEV, the Q number of this article, or S12672. EXTDEV was archived using the PKware file-compression utility.

More Information: The MULTIPAD example included with the Windows SDK illustrates how to use the ExtDeviceMode escape. The following is a function that determines if ExtDeviceMode is supported in the currently selected printer driver.

/* This function determines whether ExtDeviceMode is supported in the driver. If it is, the function calls ExtDeviceMode in the driver. If not, the function returns an error code of -1. / int CallExtDeviceMode(HWND hWnd, HANDLE phDriver, LPDEVMODE lpDevModeOutput, LPSTR lpDeviceName, LPSTR lpPort, LPDEVMODE lpDevModeInput, LPSTR lpProfile, WORD wMode) { FARPROC lpfpExtDeviceMode; if (lpfpExtDeviceMode = GetProcAddress(phDriver, (LPSTR)“EXTDEVICEMODE”)) return (lpfpExtDeviceMode)((HWND)hWnd, (HANDLE)phDriver, (LPDEVMODE)lpDevModeOutput, (LPSTR)lpDeviceName, (LPSTR)lpPort, (LPDEVMODE)lpDevModeInput, (LPSTR)lpProfile, (WORD)wMode); else return (-1); }

Additional reference words: 3.00 KBCategory: KBSubcategory: GdiPrnDrvfns Copyright Microsoft Corporation 1993.