DEVMODE and dmSpecVersion

Last reviewed: November 2, 1995
Article ID: Q96282
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.1, 3.5, and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

The dmSpecVersion field of the DEVMODE structure is intended for printer driver use only; no application programs should test this field. The purpose of this field is for new printer drivers to be able to recognize and handle DEVMODE structures created according to previous DEVMODE structure specification.

MORE INFORMATION

The DEVMODE structure is used for printer and (occasionally) display drivers when initializing. This structure is tied to the driver--not the operating system. The dmSpecVersion field does not allow an application to determine which platform (Windows version 3.1, Windows on Windows, Win32) the application is running in.

When an application fills a DEVMODE structure, it should set the dmSpecVersion field to DM_SPECVERSION. This identifies the version of the DEVMODE structure the application is generating.

If the application is querying to understand an unknown device, then special attention should be paid to the dmFields, dmSize, and dmDriverExtra fields. These fields are a reliable means of understanding what fields in the DEVMODE structure are readable.

The DEVMODE structure consists of public and private parts. The dmSpecVersion field applies to the public part. Any previously defined fields are not altered when the DEVMODE specification is updated--more fields are merely added to the end of the structure. This can mean fields used in the previous specification are ignored in a later specification. This functionality is managed by one bitfield describing what fields a driver actually uses. The new drivers just switch off the obsolete fields.

Applications using DEVMODE should always use the dmSize and dmDriverExtra fields for allocating/storing/manipulating the structure. These fields define the sizes of the public and private parts of the structure, respectively.


Additional reference words: 3.10 3.50 4.00 95
KBCategory: kbprint
KBSubcategory: GdiPrn


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: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.