How To Determine Font Size Setting

This article was previously published under Q137556
This article has been archived. It is offered "as is" and will no longer be updated.
SUMMARY
The code in this article demonstrates how to use the Foxtools.fll librarycommands to call Microsoft Windows application programming interface (API)functions to determine if the current session of Windows is using Small orLarge Fonts. The following API functions are used:
GetDC()GetDeviceCaps()ReleaseDC()				
MORE INFORMATION
The program first loads the Foxtools.fll library that is supplied withFoxPro for Windows. Then it initializes some variables and retrieves thehandle for the display device. Next, it calls the GetDeviceCaps function,requesting the number of pixels per logical inch along the display widthand height. If the number of pixels is equal to 96, Windows is runningwith Small Fonts. If the number of pixels is equal to 120, Windows isrunning with Large Fonts. The program then releases the handle to thedisplay 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 fileLOGPIXELSX = 88LOGPIXELSY = 90* get the handle to the device contextlnGetDC = RegFN("GetDC","I","I")lnHDC = CallFN(lnGetDC,0)* get the number of pixels per logical inchlnGetLogPix = 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 120IF lnLogPixX < 96  WAIT WINDOW "Windows is using smaller than Small Fonts"   ELSE IF InLogPixX = 96  WAIT WINDOW "Windows is using Small Fonts"   ELSE IF InLogPixX < 120  WAIT WINDOW "Windows is using between Small Fonts and Large Fonts"ELSE IF IF lnLogPixX = 120  WAIT WINDOW "Windows is using Large Fonts"ELSE  WAIT WINDOW "Windows is using larger than Large Fonts"ENDIF* release the handle to the device contextlnRelease = RegFN("ReleaseDC","II","I")= CallFN(lnRelease,0,lnHDC)* release the FOXTOOLS.FLL libraryRELEASE LIBRARY SYS(2004) + "FOXTOOLS.FLL"				
REFERENCES
Microsoft Windows Software Development Kit, "Programmer's Reference, Volume2: Functions," pages 350-354, 785.

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

Wingdi.h located in the C:\C700\Include directory
2.50 2.60 FoxWin
Properties

Article ID: 137556 - Last Review: 02/24/2014 08:22:16 - Revision: 2.2

  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.5a
  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.6 Standard Edition
  • Microsoft FoxPro 2.6a Standard Edition
  • kbnosurvey kbarchive kbfont kbhowto KB137556
Feedback