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

Related posts:

  1. How to Get Color Depth
  2. How to Capture the Screen
  3. How to Add/Remove new Font
  4. How to create a self Closing Message Box
  5. How to make editable List Box
  6. How to get list of all windows
  7. Vb6 Advanced Font Change Tutorial
  8. How to Cascade Internet Explorer windows on the desktop
  9. How to set a desired font globally on VB IDE. i.e., each and every time I should not change it.
  10. How to expand the width of a combobox to the width of the listed items

Filed under: Fonts Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.