Solved

How to show the Add Fonts window

Posted on 1998-11-07
4
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 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