Click to See Complete Forum and Search --> : Register system font


Vintik
December 15th, 2006, 04:30 AM
Hello, all.
I need to register system font using C++, but I do no know how to register it without restarting my computer. That is what I do:
1. Copy font file (fontfilename.otf) to C:\WINDOWS\Fonts\
2. Add key to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts, fontname REG_SZ fontfilename.otf
It works but after restarting my computer.
I know that it's possible using WinAPI, but I do not know the way. Any ideas?
Best Regards
Alexander Olekhnovich

Marc G
December 16th, 2006, 04:26 AM
Call AddFontResource or AddFontResourceEx and maybe before that CreateScalableFontResource.