The information in this article applies to:
SUMMARY
DEVCAPS2 is a sample application developed for the Windows environment
by Charles Petzold. DEVCAPS2 demonstrates how to retrieve various
capabilities of a printer or display device. This sample is included
in the book "Programming Windows Version 3," published by Microsoft
Press.
MORE INFORMATIONProblem DescriptionWhen the user selects DeviceMode from the File menu and modifies the printer settings in the dialog box, the unmodified version of DEVCAPS2 does not update the WIN.INI file with the changed information. Similarly, any changes to printer settings made using the Control Panel are not reflected in the dialog box in DEVCAPS2.The DeviceMode menu item is designed to allow the user to modify any printer settings globally, for all applications. Any application that uses the DeviceMode dialog box should use the new printer settings. In addition, the application should write the new printer settings into the WIN.INI file. ResolutionBecause the DEVCAPS2 program calls the DeviceMode() API with incorrect parameters, it exhibits the behavior described above. The following code appears in the DEVCAPS2.C file starting at line 176:
The code above sets szOutput equal to the name of the device driver
(for example, "EPSON9") rather than to the output port (for example,
"LPT1:"). To correct this problem, modify the code to add an
additional call to the strtok function, as in the following code:
After the modification, szOutput points to the output port. In the
subsequent call to DeviceMode(), the parameters are correct, and the
function works as expected.
In Windows version 3.1, applications should call ExtDeviceMode() instead of DeviceMode(). Additional query words: 3.00 3.10
Keywords : kbdocfix GdiDc kbSDKWin16 |
Last Reviewed: June 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |