Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Const LOGPIXELSX = 88
Private Const LOGPIXELSY = 90
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Sub Command1_Click()
'call the wrapper function
If IsScreenFontSmall() Then
Label1.Caption = "System is using Small fonts"
Else: Label1.Caption = "System is using Large fonts"
End If
End Sub
Private Function IsScreenFontSmall() As Boolean
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
End Function
'--end block--'
Сейчас этот форум просматривают: AhrefsBot, Google-бот и гости: 90