How to Determine Which Are in Use: Small or Large Fonts

Last reviewed: October 2, 1995
Article ID: Q137556
The information in this article applies to:
  • Microsoft FoxPro for Windows versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY

The code in this article demonstrates how to use the Foxtools.fll library commands to call Microsoft Windows application programming interface (API) functions to determine if the current session of Windows is using Small or Large Fonts. The following API functions are used:

   GetDC()
   GetDeviceCaps()
   ReleaseDC()

MORE INFORMATION

The program first loads the Foxtools.fll library that is supplied with FoxPro for Windows. Then it initializes some variables and retrieves the handle for the display device. Next, it calls the GetDeviceCaps function, requesting the number of pixels per logical inch along the display width and height. If the number of pixels is equal to 96, Windows is running with Small Fonts. If the number of pixels is equal to 120, Windows is running with Large Fonts. The program then releases the handle to the display device and the library.

   SET LIBRARY TO SYS(2004) + "FOXTOOLS.FLL" ADDITIVE

   * create variables to pass index to GetDeviceCaps()
   * this value cane be found in the WINGDI.H file

   LOGPIXELSX = 88
   LOGPIXELSY = 90

   * get the handle to the device context

   lnGetDC = RegFN("GetDC","I","I")
   lnHDC = CallFN(lnGetDC,0)

   * get the number of pixels per logical inch

   lnGetLogPix = RegFN("GetDeviceCaps","II","I")
   lnLogPixX = CallFN(lnGetLogPix,lnHDC,LOGPIXELSX)
   lnLogPixY = CallFN(lnGetLogPix,lnHDC,LOGPIXELSY)

   * determine if small or large fonts, either lnLogPixX or
   * lnLogPixY may be used to test for the values 96 or 120

   IF lnLogPixX = 96
      WAIT WINDOW "Windows is using Small Fonts"
   ENDIF

   IF lnLogPixX = 120
      WAIT WINDOW "Windows is using Large Fonts"
   ENDIF

   * release the handle to the device context

   lnRelease = RegFN("ReleaseDC","II","I")
   = CallFN(lnRelease,0,lnHDC)

   * release the FOXTOOLS.FLL library

   RELEASE LIBRARY SYS(2004) + "FOXTOOLS.FLL"

REFERENCES

Microsoft Windows Software Development Kit, "Programmer's Reference, Volume 2: Functions," pages 350-354, 785.

Foxtools.wri located in the C:\Fpw26\Goodies\Foxtools directory.

Wingdi.h located in the C:\C700\Include directory


Additional reference words: 2.50 2.50a 2.50b 2.60 2.60a FoxWin
KBCategory: kbprg kbcode
KBSubcategory: FxprgGeneral


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