Déterminer la taille de police utilisée (grande ou petite) pour le bur
cs_swic
Messages postés22Date d'inscriptionsamedi 25 janvier 2003StatutMembreDernière intervention12 mai 2003
-
29 avril 2003 à 16:09
Creatiel
Messages postés21Date d'inscriptionjeudi 1 mai 2003StatutMembreDernière intervention25 septembre 2008
-
28 août 2008 à 15:45
Salut à tous...
J'ai besoin de pouvoir déterminer si le bureau de Windows est paramétré en Grandes ou en Petites Polices de caractères (en VB6, natürlich)...
Il me semblait qu'on pouvait récupérer l'info dans la base registres via l'api GetSystemMetrics ou approchant, mais je ne me souviens plus de la syntaxe.
Si quelqu'un le sait, je serais content qu'il me le dise : ça urge, et je rame !
A défaut, je pourrais me débrouiller avec la clé de registre et les valeurs à tester...
Merci d'avance et bonne prog.
A+
Chris
A voir également:
Déterminer la taille de police utilisée (grande ou petite) pour le bur
Creatiel
Messages postés21Date d'inscriptionjeudi 1 mai 2003StatutMembreDernière intervention25 septembre 20081 28 août 2008 à 15:45
Si cela peut servir, voici une fonction qui indique si la taille des polices du Bureau Windows est paramétrée "par défaut", c'est à dire "Petites Polices".
<hr size="2" width="100%" />Option Explicit
'** TYPES **
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
'** Win32 API DECLARATIONS **
Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function SetMapMode Lib "gdi32" (ByVal hdc As Long, ByVal nMapMode As Long) As Long
'** CONSTANTS **
Global Const MM_TEXT = 1
Public Function IsDefaultFont() As Boolean
Dim hdc, hwnd, PrevMapMode As Long
Dim tm As TEXTMETRIC
' Set the default return value to small fonts
IsDefaultFont = True
' Get the handle of the desktop window
hwnd = GetDesktopWindow()
' Get the device context for the desktop
hdc = GetWindowDC(hwnd)
If hdc Then
' Set the mapping mode to pixels
PrevMapMode = SetMapMode(hdc, MM_TEXT)
' Get the size of the system font
GetTextMetrics hdc, tm
' Set the mapping mode back to what it was
PrevMapMode = SetMapMode(hdc, PrevMapMode)
' Release the device context
ReleaseDC hwnd, hdc
' If the system font is more than 16 pixels high,
' then large fonts are being used
If tm.tmHeight > 16 Then IsDefaultFont = False
End If