In batch file script the first below line copies myFont.ttf into Windows font directory, and the second line registers it into Registry.
XCOPY "myFont.ttf" "C:WindowsFonts"
REG add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionFonts" /v "myFont (TrueType)" /t REG_SZ /d myFont.ttf /f
An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.
To send this message, call the SendMessage function with the following parameters.
following code is in VB programming language but I need to send WM_FONTCHANGE using SendMessage function in batch file script or at least vbscript, But I don't know how do it in batch file script, If you know help me please, thanks.
Private Const HWND_BROADCAST = &HFFFF&
Private Const WM_FONTCHANGE = &H1D
Private Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
Dim res As Long
res = AddFontResource("C:FontsNordic__.ttf")
If res > 0 Then
SendMessage HWND_BROADCAST, WM_FONTCHANGE, 0, 0
MsgBox res & " fonts were added!"
End If
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…