Video drivers accomplish this by reporting different values for the LOGPIXELSY and LOGPIXELSX flags of the GetDeviceCaps() function. They also install a new set of system raster fonts that directly support the new display units. The operating system is not aware of this difference and is not specifically aware of whether the user has selected large fonts or small fonts. Thus, it cannot report which mode the system is currently in.
Traditionally, video drivers report a value of 96 pixels per inch for small fonts LOGPIXELSX and LOGPIXELSY values and 120 pixels per inch for large fonts LOGPIXELSX and LOGPIXELSY values. However, this is not reliable because there is no standard dictating these values. Furthermore, Windows 95 allows the user to customize these return values to any arbitrary value. Other methods, such as the name of the video driver, have historically been used to infer large fonts versus small fonts use as well, but none of these methods are reliable.
NOTE: The numbers and strings that appear in the Display Settings dialog box of the operating system are either managed by the display driver or merely data stored in the system registry. The presence of this data does not imply that the operating system can report it in a meaningful fashion.
Applications should not attempt to determine the system font size since there is no reliable way to obtain the information. Typically, developers request this information because they have used screen coordinates to design the look of their application to a specific video display setting.
The solution is to avoid using a device dependent means of specifying the application's user interface layout. Instead, you should use Dialog Base units as described by the Knowledge Base articles listed in the "References" section of this article. These methods are portable from instance to instance of the operating system irrespective of large fonts, small fonts, or screen size.
For more information on the best methods for dynamically creating dialog boxes and positioning controls please see the Knowledge Base articles listed in the "References" section of this article.
ID d'article : 177795 - Dernière mise à jour : 22 juin 2014 - Révision : 1