AHK 调用API获取系统已安装字体列表代码:
DllCall("gdi32\EnumFontFamilies","uint",DllCall("GetDC","uint",0),"uint",0,"uint",RegisterCallback("EnumFontFamilies"),"uint",a_FontList:="") Gui, Add, DropDownList, Sort choose1 vfontsList,%a_FontList% Gui, Show Return EnumFontFamilies(lpelf,lpntm,FontType,lP) { global a_FontList if (substr(StrGet(lpelf+28),1,1)<>"@") a_FontList .= StrGet(lpelf+28) . "|" Return 1 }
变量 a_FontList 即为获取到的字体列表变量(不包含由右到左竖排,即带前缀@的字体)。
时间: 2024-10-26 22:04:11