Solved

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

Posted on 1998-09-11
8
169 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
ID: 1434315
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
ID: 1434316
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
ID: 1434317
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
ID: 1434318
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:MikeP090797
ID: 1434319
sorry, didn't see the comment when posted the answer
0
 

Author Comment

by:scotslad
ID: 1434320
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
ID: 1434321
Use Dir:

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

Expert Comment

by:Mirkwood
ID: 1434322
Bought This Question.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

24 Experts available now in Live!

Get 1:1 Help Now