Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Font not Install in Windows font folder this is not same question but font not install in font folder i have applied this lines check this and solve it.

What I have tried:

VB
Imports System.Runtime.InteropServices
Imports System.IO
Imports Microsoft.Win32

Public Class Form1
    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 Button_InstallFont_Click_1(sender As Object, e As EventArgs) Handles Button_InstallFont.Click
        AddFontResource("C:\Users\MyComputer\Desktop\ALHAMBRA.ttf")
        InstallFont("C:\Users\MyComputer\Desktop\ALHAMBRA.ttf")
    End Sub
  
    Public Function InstallFont(ByVal FileName As String) As Boolean
        InstallFont = AddFontResource(FileName) <> 0
    End Function

End Class
Posted
Updated 2-Jul-19 5:22am
v2
Comments
MadMyche 2-Jul-19 10:13am    
So is this *not* a question; rather an answer to your previous questions?

The AddFontResource function does NOT install a font file to C:\Windows\Fonts. It just makes a font temporarily available to the system.

To install a font, you can copy it to the C:\Windows\Fonts folder, then register it using the code found here[^].
 
Share this answer
 
Check out this: Installing fonts via vb.net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900