Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get system font names and sizes?
Message
De
26/06/2004 08:20:05
 
 
À
26/06/2004 06:18:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00917141
Message ID:
00917515
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
>>It is stored in the registry key:
>
>>HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
>
>>Looked for KeyValue: "CaptionFont", "MenuFont", etc..
>>Or you can enumerate it. I don't have NT system right now, but I don't think it will be different.
>
>Thanks.
>Yes I found these key and values on XP machine. But they are binary.
>Do you know how to decode them?


I don't have XP, so you better check whether the data is UNICODE. You might have to modify a little ( STRCONV() ). Here is the sample code:
#Define HKCU   -2147483647  && HKey_Current_User

Declare Long RegOpenKey In AdvAPI32 ;
   Long hKey, String cSubKey, Long @phkResult

Declare Long RegQueryValueEx in AdvAPI32 ;
   Long hKey, String cValueName, Long lpReserved, ;
   Long @nType, String @cData, Long @nDataSize

Declare Long RegCloseKey In AdvAPI32 Long hKey

cKey = 'Control Panel\Desktop\WindowMetrics'
nSubKey = 0
If (RegOpenKey( HKCU, cKey, @nSubKey ) == ERROR_SUCCESS)
   ?'HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics : '

   nType = 0
   nDataSize = 260
   cData = space( nDataSize )

   nError = RegQueryValueEx( nSubKey, 'CaptionFont', 0, ;
      @nType, @cData, @nDataSize )

   If (nError == 234)   && more data, not enough buffer
      cData = space( nDataSize )
      nError = RegQueryValueEx( nSubKey, 'CaptionFont', 0, ;
         @nType, @cData, @nDataSize )
   endif

   If (nError == 0)   && success
      cFontSize = alltrim(str(asc(left( cData, 1 ))))
      cData = substr( cData, 19 )
      cData = left( cData, at(chr(0), cData)-1 )
      ? '   CaptionFont:  ' + cData + ', ' + cFontSize
   else
      ? 'Error# : ', nError
   endif

   RegCloseKey( nSubKey )
endif
Hope it works
Regards
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform