By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
the User uses large fonts as system screen font.
Here's a function how to detect the current system screen font.
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" (Byval hwnd As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (Byval hdc As Long, Byval nIndex As
Long) As Long
Declare Function ReleaseDC Lib "user32" (Byval hwnd As Long, Byval hdc As Long)
Const LOGPIXELSX = 88
Const LOGPIXELSY = 90
'[CLICK OR ANY OTHER EVENT]
Sub Click(Source As Button)
If IsScreenFontSmall() Then
Msgbox "The system is using Small fonts"
Msgbox "The system is using Large fonts"
Private Function IsScreenFontSmall() As Variant
Dim hWndDesk As Long
Dim hDCDesk As Long
Dim logPix As Long
'get the handle to the desktop window
hWndDesk = GetDesktopWindow()
'get the handle desktop display context (hDC)
hDCDesk = GetDC(hWndDesk)
'get the horizontal logical pixels
logPix = GetDeviceCaps(hDCDesk, LOGPIXELSX)
'release the hDC
Call ReleaseDC(hWndDesk, hDCDesk)
'if the return from GetDeviceCaps is 96, then
'the system is using small fonts.
IsScreenFontSmall = logPix = 96