Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# install font
Hi friends,
Please help me to provide a good solution for this. How to install a font permanently in your system programmatically, using C#. I want the font immediately available in Windows Fonts folder, without system reboot. I googled a lot, but no luck. I found AddFontResource from msdn and tried that, but that also not reflecting properly. Also SendMessage after AddfontResource hangs the system sometimes.
So, currently i opt a COPY function which will copy the font into fonts folder, and later adding the font entry in Regristry executing a batch file.
But, then the font is available from next system logon only.
 
What i'm missing here.
 
thanks in advance.
Posted 21-Dec-11 17:50pm
Edited 21-Dec-11 17:52pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Are you tried this??
Here[^]
  Permalink  
Comments
Lijo Sebastian at 22-Dec-11 2:13am
   
@Rajesh: thanks for your reply. Yes i did an attempt your link. It only works for the current session. If the User reboots the system, the font wont be available. So, what i'm trying to do is get the font in Fonts folder, so that it would persist for ever. I would be glad if you got any further info regarding this. Thanks.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I achieved same doing this:
XCOPY font file into system fonts folder using cmd prompt.
Adding font entry in registry Fonts folder.
 
Then my font was immediately available without restarting the machine.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Registry keys my ass..
 
I spend hours searching registry keys fo;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", 0, KEY_ALL_ACCESS, &hkey);
 
Does not exist?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 18 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100