Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_ListBox = 500
Global hDlg,hListBox As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "EnumFontFamiliesEx",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add ListBox, hDlg, %IDC_ListBox, , 0, 0, 200, 200, %LBS_NoIntegralHeight Or %LBS_Sort Or %LBS_Notify Or %WS_TabStop Or %WS_VScroll, %WS_Ex_ClientEdge
Control Handle hDlg, %IDC_ListBox To hListBox
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
EnumerateFonts
End Select
End Function
Sub EnumerateFonts
Local hDC As Dword, lf As LogFont
hDC = GetDC(%HWND_Desktop)
EnumFontFamiliesEx hDC, lf, CodePtr(EnumFontName), 0,0
ReleaseDC %HWND_Desktop, hDC
End Sub
Function EnumFontName(lf As LogFont, tm As TextMetric, ByVal FontType As Long, hWnd As Dword) As Long
If (FontType And %TrueType_FontType) And (Left$(lf.lfFaceName,1)<>"@") Then 'TT fonts not start with "@"
ListBox Add hDlg, %IDC_ListBox, lf.lfFaceName
End If
Function = 1
End Function
'gbs_00853
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm