第一种 读注册表$sFonts2=""
For $i=1 to 9999999
$sFonts=RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",$i)
IF @error <> 0 Then ExitLoop
$sFonts2&=$sFonts
Next
$sFiltered=StringRegExpReplace($sFonts2,"((TrueType)|(Alle Aufl?sungen)|(VGA-Aufl?sung))","")
$sFiltered=StringRegExpReplace($sFiltered,"[\(\)]",",")
$sFiltered=StringReplace($sFiltered," ,,",",")
MsgBox(0,"",$sFiltered)
第二种 调用GDI32.DLL获取字体列表#include <Array.au3>
Global $aFonts[1]
_GetSystemFonts()
_ArrayDisplay($aFonts)
Func _GetSystemFonts()
Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"
Local $hGDI32 = DllOpen("Gdi32.dll"), $hUser32 = DllOpen("user32.dll")
Local $hDesktop, $hDC, $iReturn
Local $hCBFunc = DllCallbackRegister("EnumFontFamExProc", "long", "ptr;ptr;dword;lparam")
Local $strctLOGFONT = DllStructCreate($LOGFONT)
DllStructSetData($strctLOGFONT, "lfCharset", 1)
$hDesktop = DllCall($hUser32, "hwnd", "GetDesktopWindow")
$hDC = DllCall($hUser32, "ptr", "GetWindowDC", "hwnd", $hDesktop[0])
DllCall($hGDI32, "long", "EnumFontFamiliesEx", "ptr", $hDC[0], "ptr", DllStructGetPtr($strctLOGFONT), "ptr", DllCallbackGetPtr($hCBFunc), "lparam", 10, "DWORD", 0)
$aFonts = _ArrayUnique($aFonts, 1, 1)
_ArraySort($aFonts, 0,1)
DllCall($hUser32, "int", "ReleaseCapture")
DllCallbackFree($hCBFunc)
DllClose($hGDI32)
DllClose($hUser32)
EndFunc ;==>_GetSystemFonts
Func EnumFontFamExProc($pLOGFONT, $TEXTMETRIC, $dwType, $lpData)
Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"
ReDim $aFonts[UBound($aFonts)+1]
$aFonts[UBound($aFonts)-1] = DllStructGetData(DllStructCreate($LOGFONT, $pLOGFONT), "lfFaceName")
Return 1
EndFunc ;==>EnumFontFamExProc
|