Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get system font names and sizes?
Message
From
26/06/2004 08:20:05
 
 
To
26/06/2004 06:18:05
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00917141
Message ID:
00917515
Views:
20
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform