Taille police windows

Résolu
haroun2005 Messages postés 27 Date d'inscription lundi 19 décembre 2005 Statut Membre Dernière intervention 5 juin 2006 - 13 févr. 2006 à 15:51
haroun2005 Messages postés 27 Date d'inscription lundi 19 décembre 2005 Statut Membre Dernière intervention 5 juin 2006 - 14 févr. 2006 à 12:43
salut,
comment faire avec VB6 pour savoir si la taille de la police windows est normal(96 ppp) ou bien (120ppp)grande?
j'ai cherché API getdisplaysettings mais j'ai pas trouvé.
merci pour l'aide!

4 réponses

cs_Willi Messages postés 2375 Date d'inscription jeudi 12 juillet 2001 Statut Modérateur Dernière intervention 15 décembre 2018 22
14 févr. 2006 à 11:30
Salut,
Ajoute un module et colle y le code suivant

Private Type TEXTMETRIC
tmHeight As Integer
tmAscent As Integer
tmDescent As Integer
tmInternalLeading As Integer
tmExternalLeading As Integer
tmAveCharWidth As Integer
tmMaxCharWidth As Integer
tmWeight As Integer
tmItalic As String * 1
tmUnderlined As String * 1
tmStruckOut As String * 1
tmFirstChar As String * 1
tmLastChar As String * 1
tmDefaultChar As String * 1
tmBreakChar As String * 1
tmPitchAndFamily As String * 1
tmCharSet As String * 1
tmOverhang As Integer
tmDigitizedAspectX As Integer
tmDigitizedAspectY As Integer
End Type


Private Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function SetMapMode Lib "gdi32" (ByVal hdc As Long, ByVal nMapMode As Long) As Long


Const MM_TEXT = 1


Public Function FontIsLarge() As Boolean

Dim hdc As Long
Dim hwndDesktop As Long
Dim PrevMapMode As Long
Dim tm As TEXTMETRIC


'Handle du bureau
hwndDesktop = GetDesktopWindow()

If hwndDesktop <> 0 Then


hdc = GetWindowDC(hwndDesktop)

If hdc <> 0 Then

'Mapping mode
PrevMapMode = SetMapMode(hdc, MM_TEXT)
'Taille police systeme
GetTextMetrics hdc, tm
'Mapping mode état d'orginine
PrevMapMode = SetMapMode(hdc, PrevMapMode)

'Release device context
ReleaseDC hwndDesktop, hdc

'Si la taille = 16 taille police normal
If tm.tmHeight <> 16 Then
FontIsLarge = True
Else
FontIsLarge = False
End If

End If

End If

End Function



Pour utiliser la fonction FontIsLarge:

If FontIsLarge Then
MsgBox "Taille de police utilisé par le système est GRANDE"
Else
MsgBox "Taille de police utilisé par le système est NORMALE"
End If


<HR width="100%" SIZE=2>



Si la réponse te conviens merci de l'accepter
3
cs_Willi Messages postés 2375 Date d'inscription jeudi 12 juillet 2001 Statut Modérateur Dernière intervention 15 décembre 2018 22
13 févr. 2006 à 16:08
'Lut,
Regarde sur allapi.net il y a un exemple qui montre comment obtenir des informations sur la police utilisée.
Rubrique example en bas de ce lien cela te donnera surement ce que tu recherches: http://www.mentalis.org/apilist/SystemParametersInfo.shtml

Bon courage


<HR width="100%" SIZE=2>
Si la réponse te conviens merci de l'accepter
0
haroun2005 Messages postés 27 Date d'inscription lundi 19 décembre 2005 Statut Membre Dernière intervention 5 juin 2006
14 févr. 2006 à 09:11
salut,
merci pour l'aide, mais je ne sais pas au juste comment parametrer cette fonction pour tester la taille police windows!(en plus je suis pas doué en anglais !)
l'example associé font info a determiné les caracteristiques de la police (height, weight, itallic) mais non ce que je cherchais!
merci encore une fois
0
haroun2005 Messages postés 27 Date d'inscription lundi 19 décembre 2005 Statut Membre Dernière intervention 5 juin 2006
14 févr. 2006 à 12:43
merci infiniment!
0
Rejoignez-nous