Finding out the size of the font being used by the system

Do you need to know whether the system is using large fonts? Use this simple procedure to return a Boolean value. Add these declarations:

Declarations

Public Declare Function GetDesktopWindow Lib _
"user32" () As Long

Public Declare Function GetDC Lib "user32" (ByVal _
hwnd As Long) As Long

Public Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long

Public Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long

Public Const LOGPIXELSX = 88

Add the following code to a module or form

Public Function IsScreenFontSmall() As Boolean 
Dim hWndDesk As Long 
Dim hDCDesk As Long 
Dim logPix As Long 
Dim r As Long 
hWndDesk = GetDesktopWindow() 
hDCDesk = GetDC(hWndDesk) 
logPix = GetDeviceCaps(hDCDesk, LOGPIXELSX) 
r = ReleaseDC(hWndDesk, hDCDesk) 
IsScreenFontSmall = (logPix = 96 )
End Function

The method of this is easy:
1) Get the HWnd for the desktop
2) Find out the logical pixels in the height of the font
3) If this is equal to 96, then small fonts are used, otherwise, it is something else.


Free Blackjack | Family Insurance Quotes | Discount Mini Blinds | Jewelry Directory | Blogsearch