Results 1 to 4 of 4

Thread: Large Font - Small Font

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    New Delhi, India
    Posts
    75
    In VB 6.0 how can I detect for Small font or Large Font setting.

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    Here try this... it's a function that I made a while ago to get the font setting even if a custom size is used. it returns the percentage of the font ie. small font is 96 dpi or 100% and large font is 120 dpi or 125%... I use it for helping to control screen resolution issues from computer to computer...

    Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseDC Lib "user32" _
    (ByVal hwnd As Long, ByVal hdc As Long) As Long

    Const LOGPIXELSX = 88

    'size of small font
    Const SmallFont = 96 'dpi (100%)

    Private Function ScreenFont() As Long
    'get the font size (in %) that is being used on the current computer
    Dim hWnd, hDC, logPix, r As Long

    hWnd = GetDesktopWindow()
    hDC = GetDC(hWnd)
    logPix = GetDeviceCaps(hDC, LOGPIXELSX)
    r = ReleaseDC(hWnd, hDC)
    ScreenFont = logPix
    End Function

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    New Delhi, India
    Posts
    75

    Wink

    Thax indeed for that :-). thats fast reply. hmmm!!!

    I was using the following technique quite while now using the following one line .....

    If GetSystemMetrics(15) <> 19 And QueryValue(HKEY_LOCAL_MACHINE, Config\0001\Display\Settings", "DPIPhysicalX") <> 96 Then
    msgbox "This Application works only with system font set to SMALL fonts."
    End
    End If


    .........until i received a call that it worked otherwise. thats how i pressed the panick button. but anyway i will try these. please let me know whats wrong with the above ones...

  4. #4
    Hyperactive Member davem's Avatar
    Join Date
    Dec 2000
    Location
    Gainesville, FL
    Posts
    265
    Ok... so this tells us what the font scaling is. I have designed my program and it looks really screwed up if the user uses anything other than small fonts... what can I do to change the font scaling? Is there an API that I can call to set the font scaling to 100% (96 dpi) for use in my program?

    If not... any ideas on scaling information?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width