Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to install a new font through code Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
Graphic
Language
Delphi 2.x
Views
92
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to install a new font through code

Answer:

1   uses
2     Registry;
3   
4   procedure TForm1.Button1Click(Sender: TObject);
5   var
6     reg: TRegistry;
7     b: bool;
8   begin
9     CopyFile('C:\DOWNLOAD\FP000100.TTF', 'C:\WINDOWS\FONTS\FP000100.TTF', b);
10    reg := TRegistry.Create;
11    reg.RootKey := HKEY_LOCAL_MACHINE;
12    reg.LazyWrite := false;
13    reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Fonts', false);
14    reg.WriteString('TESTMICR (TrueType)', 'FP000100.TTF');
15    reg.CloseKey;
16    reg.free;
17    {Add the font resource}
18    AddFontResource('c:\windows\fonts\FP000100.TTF');
19    SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
20    {Remove the resource lock}
21    RemoveFontResource('c:\windows\fonts\FP000100.TTF');
22    SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
23  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC