Announcement

Collapse
No announcement yet.

GetStockObject(%SYSTEM_FONT)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kev Peel
    replied
    It's unfortunate it doesn't work on NT/2000.

    Semen, I think the only way is to create a hidden dialog and use GetObject for the font, as you have done.

    Regards,

    ------------------
    Kev G Peel
    KGP Software, Bridgwater, UK.
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Lance Edmonds
    replied
    Returns "MS Sans Serif" for all settings on my Win2K box (US English, NZ locale).

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Semen Matusovski
    replied
    Kev -
    It simply doesn't work under Win2000 (always RegFailedEx
    Unlike the same keys are present in registry, MS could change format (they have full right to do this - not documented).


    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Kev Peel
    replied
    semen,

    i researched this back in december 2000 and came up with a solution (which i have just updated a bit)

    see: http://www.powerbasic.com/support/pb...ad.php?t=22866

    regards,

    ------------------
    kev g peel
    kgp software, bridgwater, uk.
    mailto:[email protected][email protected]</a>

    Leave a comment:


  • Semen Matusovski
    replied
    MSDN about GetStockObject
    Code:
    SYSTEM_FONT System font. By default, the system uses the system font to draw menus, dialog box controls, and text. 
    Windows 95/98 and NT: The system font is MS Sans Serif. 
    Windows 2000 or later: The system font is Tahoma
    Guess that under 9x and NT 4 GetStockObject(%SYSTEM_FONT) returns facename "MS Sans Serif".
    But not under Win2000 - here SYSTEM_FONT = SYSTEM_FIXED_FONT

    Actually is used a font, with nick-name MS Shell Dlg 2 (described in FontSubstitutions as Tahoma).

    So, de-facto I need to retrieve default font for dialogs.
    Is it possible w/o creating a dialog ?


    Added later.

    I created rc
    Code:
    TESTDIALOG DIALOGEX 0, 0, 0, 0
    STYLE 0x48L | 0x80000000L
    FONT 8, "MS Shell Dlg"
    BEGIN
    END
    In program
    Code:
       Global lf_DefaultDialogFont As LOGFONT
    
       Function TestDialog_Proc(ByVal hDlg As Long, ByVal wMsg As Long, _
                       ByVal wParam As Long, ByVal lParam As Long) As Long
    
          Select Case wMsg
             Case %WM_INITDIALOG
                GetObject SendMessage (hDlg, %WM_GETFONT, 0, 0), Len(LOGFONT), ByVal VarPtr(lf_DefaultDialogFont)
                EndDialog hDlg, 0
          End Select
       End Function
    
    .....
    
             DialogBox GetModuleHandle(""), "TESTDIALOG", 0, CodePtr(TestDialog_Proc)
    On my PC works (under Win2000 and sure/hope - everywhere).
    But I don't like similar solution.

    [This message has been edited by Semen Matusovski (edited October 07, 2001).]

    Leave a comment:


  • Chris Boss
    replied
    Semen;

    There are five predefined fonts in Windows :

    System Font
    System Fixed Font
    Ansi Variable Pitch Font
    Ansi Fixed Pitch Font
    MS Sans Serif (Default GUI Font)
    Terminal Font (OEM/DOS)

    The default font for windows is the System Font. DDT changes it
    to MS Sans Serif (8 pt) for DDT created dialogs.

    I don't now about Menus, what font they use by default, but windows
    use the System Font.




    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    System doesn't map to Tahoma.

    MSDN talks
    Windows 2000 or later: Windows 2000 uses a different system font than Windows NT 4.0 and Windows 95/98. To have your application use the system font no matter which system it is running on, use DS_SHELLFONT with the typeface MS Shell Dlg, and use the DIALOGEX resource instead of the DIALOG resource. The system maps this typeface such that your dialog box will use the Tahoma font on Windows 2000 and the MS Sans Serif font on earlier systems. Note that DS_SHELLFONT has no effect if the typeface is not MS Shell Dlg.
    I have SDK window and have no a big wish to create dummy dialog.
    Ok, I can recognize an OS and to specify "Tahoma" (bad way).
    But in any case I need to know, what means "default" size (in points ? how much)
    Any ideas ?



    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Adrian C Aitken
    replied
    Semen , I get 'System' on my UK language Win2000 box although looking in the fonts directory there is no 'System' font but there is Tahoma.

    Adrian

    ------------------

    Leave a comment:


  • Semen Matusovski
    started a topic GetStockObject(%SYSTEM_FONT)

    GetStockObject(%SYSTEM_FONT)

    Guys --
    What returns on your PC
    Code:
    Local lf As LOGFONT
    GetObject GetStockObject(%SYSTEM_FONT), SizeOf(lf), ByVal VarPtr(lf)
    MsgBox lf.lfFaceName
    under Win2000 ? (I see System instead of Tahoma, but all system menues are correct - Tahoma)

    ------------------
    E-MAIL: [email protected]
Working...
X