VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn'

by Jeffry O'neil ()
Category: Windows API Call/Explanation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 5th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn't listed in the FONTS directory of Windows)

API Declarations


Private Declare Function RemoveFontResource Lib "gdi32" Alias "RemoveFontResourceA" (ByVal lpFileName As String) As Long


Rate This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn'



'FntFileName is my font's name and path
Public Function LoadFont(FntFileName As String) As Boolean
    Dim FntRC As Long
        FntRC = AddFontResource(FntFileName)
        If FntRC = 0 Then 'no success
         LoadFont = False
        Else              'success: font loaded!
         LoadFont = True
        End If
End Function

Public Function RemoveFont(FntFileName As String) As Boolean
     Dim RC As Long  

     Do
       RC = RemoveFontResource(FntFileName)
     Loop  Until RC=0
     'if rc=0 then font removed or invalid file name
End Function


Download this snippet    Add to My Saved Code

This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn' Comments

No comments have been posted about This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn'. Why not be the first to post a comment about This simple program loads or removes any FONT from a specified path & file name (Loaded font doesn'.

Post your comment

Subject:
Message:
0/1000 characters