CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006
    Location
    Belarus
    Posts
    18

    Register system font

    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

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Register system font

    Call AddFontResource or AddFontResourceEx and maybe before that CreateScalableFontResource.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured