Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB7
Expertise: Intermediate
May 19, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

IsSystemFontSmall - Checking whether the system is using small fonts

<System.Runtime.InteropServices.DllImport("user32")> Shared Function _
    GetDesktopWindow() As Integer
End Function

<System.Runtime.InteropServices.DllImport("user32")> Shared Function GetDC _
    (ByVal hWnd As Integer) As Integer
End Function

<System.Runtime.InteropServices.DllImport("gdi32")> Shared Function _
    GetDeviceCaps(ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
End Function

<System.Runtime.InteropServices.DllImport("user32")> Shared Function ReleaseDC _
    (ByVal hWnd As Integer, ByVal hDC As Integer) As Integer
End Function    

' Returns a boolean indicating whether ths system is using small fonts
Function IsSystemFontSmall() As Boolean
    Const LOGPIXELSX = 88

    ' get its device context
    Dim hDC As Integer = GetDC(GetDesktopWindow())
    ' if the number of pixels per logical inch is = 96
    ' then Windows is using small system font
    IsSystemFontSmall = (GetDeviceCaps(hDC, LOGPIXELSX) = 96)
    ' release the device context
    ReleaseDC(GetDesktopWindow(), hDC)
End Function
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date