SAMPLE: Calling ExtDeviceMode/DeviceCapabilities in Win32s App

Last reviewed: July 3, 1997
Article ID: Q132239
1.25a 4.00 | 3.50
WINDOWS    | WINDOWS NT
kbprint kbfile

The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
        - Microsoft Win32s version 1.25a
    

A Win32-based application running under Windows NT or Windows 95 can call DocumentProperties to change printer settings and DeviceCapabilities to query printer driver capabilities. But if the Win32-based appliction is running under Win32s, it has to load and call printer drivers directly by using calls such as LoadLibrary, GetProcAddress, ExtDeviceMode, and DeviceCapabilities.

Win32s handles these two printer driver functions specifically by creating a mapping thunk dynamically. The address returned to the Win32-based application by GetProcAddress is actually the address to the thunk that makes the 32-bit to 16-bit transition and calls the printer driver.

The DEVCAP sample shows:

  • How to use DeviceCapabilities to query printer driver capabilities.
  • How to use DocumentProperties under Windows NT or Windows 95 to change printing orientation.
  • How to use ExtDeviceMode under Win32s to change printing orientation.
  • How to work around two DeviceCapabilities bugs in the current version of Win32s (1.25.142) where DC_BINS and DC_PAPERS retrieve a list of DWORD items instead of a list of WORD items.

NOTE: Prior to version 1.25.142, Win32s contained a bug that didn't allow ExtDeviceMode to change printing orientation.

Download DEVCAP.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download DEVCAP.EXE (size: 28835 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the SOFTLIB\MSLFILES directory
          Get DEVCAP.EXE (size: 28835 bytes) 
    

    Additional reference word: 3.50 4.00 95 softlib


KBCategory: kbprint kbfile
KBSubcategory: GdiPrn
Keywords : GdiPrn kbfile kbprint
Version : 1.25a 4.00 | 3.50
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.