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, "EnumFonts",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
hDC = GetDC(%HWND_Desktop)
EnumFonts hDC, ByVal %NULL, CodePtr(EnumFontName), ByVal VarPtr(hListBox)
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_00854
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm