Private Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
Private Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long
Private Sub Command1_Click() '安装字体
AddFontResource App.Path & "\xxxx.ttf"
End Sub
Private Sub Command2_Click() '删除字体
RemoveFontResource App.Path & "\xxxx.ttf"
End Sub
Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long
增加字体:
Dim lResult As Long
lResult = AddFontResource("c:myAppmyFont.ttf")
删除字体:
Dim lResult As Long
lResult = RemoveFontResource("c:myAppmyFont.ttf")
'声明:
Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" _
(ByVal lpFileName As String) As Long
Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" _
(ByVal lpFileName As String) As Long
'代码:
'增加字体:
Dim lResult As Long
lResult = AddFontResource("c:\myApp\myFont.ttf")
'删除字体:
Dim lResult As Long
lResult = RemoveFontResource("c:\myApp\myFont.ttf")