Solved

How do I get fonts to install when I install app?

Posted on 1998-09-11
8
168 Views
Last Modified: 2013-12-03
I have an application which uses special fonts. I need these fonts to be installed into the fonts directory when the s/w is installed. How do I go about doing this? I am using VB5 enterprise and the Application Setup Wizard. I do not want to have to copy the files into the fonts directory myself and I do not want to use:

    Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long

I want the fonts to be installed automatically with the software. Thanks in advance.
0
Comment
Question by:scotslad
8 Comments
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
SW doesn't provides that capability. You can make SW copy the fonts to your app's directory, and then install them, and delelte them on the first run.
0
 

Author Comment

by:scotslad
Comment Utility
If this is the case, how do I determine the windows path since the path differs from Win95/98 to Win NT and the user may change the deault name for the windows directory as well? Also I would only want to do this the first time the program is run. How can I test that the fonts are installed successfully so I don't try to install them again?

0
 
LVL 2

Expert Comment

by:shchuka
Comment Utility
You can use these API's:

Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
Comment Utility
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


Use those API's to get windows or system path, whatever you need.
AddFontResource  will return 0 in case of error. To make sure you install the fonts only once, just delete them from the program's directory, and check if they are there before you install them
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
sorry, didn't see the comment when posted the answer
0
 

Author Comment

by:scotslad
Comment Utility
One last point then. If I use FileCopy and Kill to copy the files then delete them, how do I check if the file is in the directory. Pretty simple I know but I haven't had to check if a file exists before.

Cheers.

0
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
Use Dir:

If Dir("C:\Dir1\File1.dat")<> "" then 'File exist
0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Bought This Question.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now