CodeItBetter Programming Another VB Programming Blog

How to check Windows Font Size

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'Fonts - How to check Windows Font Size

'This example will return 'True' if the font size is small, and 'False' If font size is large

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
 
Public Function IsScreenFontSmall() As Boolean
    Dim hWndDesk As Long, hDCDesk As Long, logPix As Long
    hWndDesk = GetDesktopWindow()
    hDCDesk = GetDC(hWndDesk)
    logPix = GetDeviceCaps(hDCDesk, LOGPIXELSX)
    Call ReleaseDC(hWndDesk, hDCDesk)
    IsScreenFontSmall = (logPix = 96)
End Function
 
Private Sub Main()
    MsgBox IsScreenFontSmall
End Sub
Filed under: Fonts Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.