Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SystemParametersInfo API
Message
 
À
18/06/2001 15:59:29
Information générale
Forum:
Visual Basic
Catégorie:
Fonctions API de Windows
Divers
Thread ID:
00520749
Message ID:
00520881
Vues:
13
Hi, Gary!
You can use next sample (it's tested):
Const LF_FACESIZE = 32
Const SPI_GETNONCLIENTMETRICS = 41
Const SPI_SETNONCLIENTMETRICS = 42
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 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 As String * LF_FACESIZE
End Type
Private Type NONCLIENTMETRICS
        cbSize As Long
        iBorderWidth As Long
        iScrollWidth As Long
        iScrollHeight As Long
        iCaptionWidth As Long
        iCaptionHeight As Long
        lfCaptionFont As LOGFONT
        iSMCaptionWidth As Long
        iSMCaptionHeight As Long
        lfSMCaptionFont As LOGFONT
        iMenuWidth As Long
        iMenuHeight As Long
        lfMenuFont As LOGFONT
        lfStatusFont As LOGFONT
        lfMessageFont As LOGFONT
End Type

Private Sub Form_Load()
    Dim ncm As NONCLIENTMETRICS
    ncm.cbSize = Len(ncm)
    Dim OldHeight As Long
    Dim OldWeight As Long
    
    Call SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, ncm, 0)
    OldHeight = ncm.lfMessageFont.lfHeight
    ncm.lfMessageFont.lfHeight = 24
    OldWeight = ncm.lfMessageFont.lfWeight
    ncm.lfMessageFont.lfWeight = 700    'Bold
    Call SystemParametersInfo(SPI_SETNONCLIENTMETRICS, 0, ncm, 0)
    MsgBox "Hello!", vbInformation
    ncm.lfMessageFont.lfHeight = OldHeight
    ncm.lfMessageFont.lfWeight = OldWeight
    Call SystemParametersInfo(SPI_SETNONCLIENTMETRICS, 0, ncm, 0)
End Sub
>Has anyone out there ever used SystemParametersInfo
>What I am trying to do is change the font for the message box.
>how can I use SystemParametersInfo to do so.
>
>I know that I will use uiAction = SPI_SETNONCLIENTMETRICS
>but how exactly would I tell it that I want to use a different
>font??
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform