CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: System Fonts

  1. #1
    Join Date
    Oct 2000
    Location
    Germany / Bremen
    Posts
    25

    System Fonts

    Hi CodeGurus,

    First, I'm from germany, so my english is not so good and some names of controls and windows components are slightly different, please try to understand me

    Ok, I know that I can get all fonts in the actual windows system by screen.fonts .
    But I want the fonts windows uses in the display -> appearance properties.
    The Standard is Sans Serif, but I for example use always Verdana, because I like it more.

    How can I get the fonts of the appearance properties?

    thx in advance,
    Tom


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: System Fonts

    I'm not exactly clear on what you want to do. Do you:
    1. Want to see what the current font setting is?
    2. See what the possible fonts are?
    3. Set the current font setting?




  3. #3
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: System Fonts

    Hope this helps:


    option Explicit
    private Const LF_FACESIZE = 32
    private Type LOGFONT
    lfHeight as Long
    lfWidth as Long
    lfEscapement as Long
    lfOrientation as Long
    lfWeight as Long
    lfItalic as Byte
    lfUnderline as Byte
    lfStrikeOut as Byte
    lfCharSet as Byte
    lfOutPrecision as Byte
    lfClipPrecision as Byte
    lfQuality as Byte
    lfPitchAndFamily as Byte
    lfFaceName(LF_FACESIZE) as Byte
    End Type

    private Const SPIF_SENDWININICHANGE = &H2
    private Const SPIF_SENDCHANGE = SPIF_SENDWININICHANGE
    private Const SPIF_UPDATEINIFILE = &H1

    private Const SPI_GETICONTITLELOGFONT = 31
    private Const SPI_SETICONTITLELOGFONT = 34

    private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (byval uAction as Long, byval uParam as Long, byref lpvParam as Any, byval fuWinIni as Long) as Long
    private Sub Command1_Click()
    Dim x as LOGFONT
    Dim y as Long
    Dim i as Integer
    Dim sTemp() as Byte

    y = len(x)
    'get Current System Font
    SystemParametersInfo SPI_GETICONTITLELOGFONT, y, x, 0

    'Change it to Arial
    'If anyone has a 'prettier' way to do this, let me know!!
    sTemp() = StrConv("Arial", vbFromUnicode)
    for i = 0 to LF_FACESIZE - 1
    If i <= UBound(sTemp) - 1 then
    x.lfFaceName(i) = sTemp(i)
    else
    x.lfFaceName(i) = 0
    End If
    next i

    'set to pitch to 14
    x.lfHeight = -14
    'set weight to 'Bold'
    x.lfWeight = 700
    y = len(x)

    'set new font
    SystemParametersInfo SPI_SETICONTITLELOGFONT, y, x, SPIF_SENDCHANGE Or SPIF_UPDATEINIFILE
    End Sub

    private Sub Form_Load()
    Command1.Caption = "set System Font"
    End Sub






  4. #4
    Join Date
    Oct 2000
    Location
    Germany / Bremen
    Posts
    25

    Re: System Fonts

    But I only want to read out all the fonts. Not only the one in the windows, the fonts used for captions too.



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

Featured