Solved

How to show the Add Fonts window

Posted on 1998-11-07
4
219 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now