Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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.

 

 

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