Solved

How to show the Add Fonts window

Posted on 1998-11-07
4
228 Views
Last Modified: 2013-12-02
I would like to know how I can show the 'Add Fonts' window (Control Panel/Fonts/Add Fonts) from my program and if possible at a predifined location (like e:\new fonts)
with the 'Copy fonts to Fonts folder' option ON.

API, Shell, regular or custom code, it doesn't matter.
I'm using VB6-SP1.

Note:
I know I can show the Fonts window from the Control Panel with the Shell command
rundll32.exe shell32.dll,Control_RunDLL main.cpl @3, but I realy need to trigger the 'Add Fonts' window.

Thank you!
0
Comment
Question by:bluefive
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 200 total points
ID: 1443841
You can build one pretty easily by yourself, using DirList and FileList controls, and to actualy install the font, you can use AddFontResource.
If you need more details, just ask.
0
 

Author Comment

by:bluefive
ID: 1443842
Is AddFontResource all I need?
I thought this would make a font available to the system just temporarily...

Don't I have to do something like:
a. Copy the font to the fonts dir
b. Write to the registry
c. Call AddFontResource
d. Call CreateSccalableFontResource
e. Call SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0)

Or am I making things too complicated? Please tell me I do! ;-)


0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1443843
You will need to copy the font into the font dir, but you don't need CreateScallableFontResource. AddFontResource takes every type of fonts:

>>Pointer to a null-terminated character string that contains a valid font file filename. The filename may specify either a .FON font resource file, a .FNT raw bitmap font file, a .TTF raw TrueType file, or a .FOT TrueType resource file.

You will also have to notify with WM_FONTCHANGED, I forgot that part.
0
 

Author Comment

by:bluefive
ID: 1443844
Thanks very much!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

803 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