注册字体

优质
小牛编辑
124浏览
2023-12-01
例一:

!include WinMessages.nsh
Section "MainSection" SEC01
File /oname=$FONTS\tahoma.ttf tahoma.ttf
Push "$FONTS\tahoma.ttf"
System::Call "Gdi32::AddFontResource(t s) i .s"
Pop $0
IntCmp $0 0 0 +2 +2
MessageBox MB_OK "注册字体失败"
SendMessage ${HWND_BROADcast} ${WM_FONTCHANGE} 0 0
SectionEnd

例二:

/*注册字体 by Ansifa*/
XPStyle on
OutFile "注册字体.EXE"
Name "注册字体"
Section
StrCpy $0 "D:\Fonts\经典空趣体繁.ttf"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "经典空趣体繁(TrueType)" "$0"
System::Call "GDI32::AddFontResource(t) i ('$0') .s"
ClearErrors
SectionEnd