调试的时候提示"文件未找到:GDI",光标停在函数CreateScalableFontResource处,安装字体的程序代码如下(已经把字体文件bookosb.ttf复制到c:/windows/system下):
Private Declare Function CreateScalableFontResource% Lib "GDI" _
(ByVal fHidden%, ByVal lpszResourceFile, ByVal lpszFontFile, ByVal lpszCurrentPath) Private Declare Function AddFontResource Lib "GDI" _
(ByVal lpFilename As Any) As Integer Private Declare Function WriteProfileString Lib "Kernel" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String) As Integer Private Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, _
ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As LongPrivate Sub Command1_Click()
Dim Ret%, Res&, FontPath$, FontRes$
Const WM_FONTCHANGE = &H1D
Const HWND_BROADCAST = &HFFFF
FontFileName$ = "bookosb.ttf"
WinSysDir$ = "c:\WINDOWS\SYSTEM"
FontPath$ = WinSysDir$ + "\" + FontFileName$
FontRes$ = Left$(FontPath$, Len(FontPath$) - 3) + "FOT"
Ret% = CreateScalableFontResource%(0, FontRes$, _
FontFileName$, WinSysDir$)
Ret% = AddFontResource(FontRes$)
Res& = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
Ret% = WriteProfileString("fonts", FontName + " " & _
"(TrueType)", FontRes$)
End Sub
请问是什么问题?谢谢
Private Declare Function CreateScalableFontResource% Lib "GDI" _
(ByVal fHidden%, ByVal lpszResourceFile, ByVal lpszFontFile, ByVal lpszCurrentPath) Private Declare Function AddFontResource Lib "GDI" _
(ByVal lpFilename As Any) As Integer Private Declare Function WriteProfileString Lib "Kernel" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String) As Integer Private Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, _
ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As LongPrivate Sub Command1_Click()
Dim Ret%, Res&, FontPath$, FontRes$
Const WM_FONTCHANGE = &H1D
Const HWND_BROADCAST = &HFFFF
FontFileName$ = "bookosb.ttf"
WinSysDir$ = "c:\WINDOWS\SYSTEM"
FontPath$ = WinSysDir$ + "\" + FontFileName$
FontRes$ = Left$(FontPath$, Len(FontPath$) - 3) + "FOT"
Ret% = CreateScalableFontResource%(0, FontRes$, _
FontFileName$, WinSysDir$)
Ret% = AddFontResource(FontRes$)
Res& = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
Ret% = WriteProfileString("fonts", FontName + " " & _
"(TrueType)", FontRes$)
End Sub
请问是什么问题?谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货