Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. AddFontResourceEx

AddFontResourceEx

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionlearning
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RaymondM
    wrote on last edited by
    #1

    I am trying to include AddFontResourceEx(Fontname,FR_PRIVATE,0); but get the error message that the function and FR_PRIVATE are undefined. Of course I have wingdi.h in the opening lines : #define UNICODE // Save as Unicode -Codepage 1200 #include ; #include ; The error is produced when I try to compile. I have added gdi32.lib to the command line. What am I supposed to do about gdi32.dll ? Thanks for any help Raymond Mercier

    R 1 Reply Last reply
    0
    • R RaymondM

      I am trying to include AddFontResourceEx(Fontname,FR_PRIVATE,0); but get the error message that the function and FR_PRIVATE are undefined. Of course I have wingdi.h in the opening lines : #define UNICODE // Save as Unicode -Codepage 1200 #include ; #include ; The error is produced when I try to compile. I have added gdi32.lib to the command line. What am I supposed to do about gdi32.dll ? Thanks for any help Raymond Mercier

      R Offline
      R Offline
      RaymondM
      wrote on last edited by
      #2

      Sorry, this failed to appear ! #define UNICODE // Save as Unicode -Codepage 1200 #include <windows.h> #include <Winbase.h> #include <WinGDI.h>

      L 1 Reply Last reply
      0
      • R RaymondM

        Sorry, this failed to appear ! #define UNICODE // Save as Unicode -Codepage 1200 #include <windows.h> #include <Winbase.h> #include <WinGDI.h>

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You need to install the Platform SDK[^] or Windows SDK[^]. Which SDK is Right for Me?[^] Best Wishes, -David Delaune

        R 1 Reply Last reply
        0
        • L Lost User

          You need to install the Platform SDK[^] or Windows SDK[^]. Which SDK is Right for Me?[^] Best Wishes, -David Delaune

          R Offline
          R Offline
          RaymondM
          wrote on last edited by
          #4

          Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1. Meanwhile I have managed (sort of) with these lines, which do allow me to get the function. I still fail to see why I have to go through all this, but not for AddFontResource, and I still have to put 0x10, since FR_PRIVATE is not recognized. static FARPROC fpAddFontRes,fpRemoveFontRes; HMODULE hLibrary; hLibrary=LoadLibraryW(L"gdi32.dll"); fpAddFontRes=GetProcAddress(hLibrary,(LPCSTR)"AddFontResourceExW"); fpRemoveFontRes=GetProcAddress(hLibrary,(LPCSTR)"RemoveFontResourceExW"); ..... nFontLoad=(*fpAddFontRes)(Bact,0x10,0); At least this works fine ! Raymond Mercier

          L 1 Reply Last reply
          0
          • R RaymondM

            Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1. Meanwhile I have managed (sort of) with these lines, which do allow me to get the function. I still fail to see why I have to go through all this, but not for AddFontResource, and I still have to put 0x10, since FR_PRIVATE is not recognized. static FARPROC fpAddFontRes,fpRemoveFontRes; HMODULE hLibrary; hLibrary=LoadLibraryW(L"gdi32.dll"); fpAddFontRes=GetProcAddress(hLibrary,(LPCSTR)"AddFontResourceExW"); fpRemoveFontRes=GetProcAddress(hLibrary,(LPCSTR)"RemoveFontResourceExW"); ..... nFontLoad=(*fpAddFontRes)(Bact,0x10,0); At least this works fine ! Raymond Mercier

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            RaymondM wrote:

            Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1.

            My recommendation remains the same. The updated headers are included with the Platform SDK. You can use the Platform SDK with VC6. I have a copy of VC6 installed along-side several versions of the Platform SDK. I can't believe that you went this many years without it. The LoadLibrary/GetProcAddress technique will also work if you choose to do it that way. But the next time you try to use a new GDI enum/constant or data type you might be back in the same boat.

            RaymondM wrote:

            I still fail to see why I have to go through all this, but not for AddFontResource

            AddFontResource[^] was included in the VC6 header distribution. AddFontResourceEx [^]is available in Windows 2000 and above and the header file was updated in the Platform SDK. The declaration for AddFontResourceEx [^]is preceeded by:#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
            So you would need: 1.) A header file with the AddFontResourceEx declaration. 2.) Declare a windows version greater or equal to _WIN32_WINNT_WIN2K. Best Wishes, -David Delaune

            modified on Tuesday, January 27, 2009 3:19 AM

            R 1 Reply Last reply
            0
            • L Lost User

              RaymondM wrote:

              Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1.

              My recommendation remains the same. The updated headers are included with the Platform SDK. You can use the Platform SDK with VC6. I have a copy of VC6 installed along-side several versions of the Platform SDK. I can't believe that you went this many years without it. The LoadLibrary/GetProcAddress technique will also work if you choose to do it that way. But the next time you try to use a new GDI enum/constant or data type you might be back in the same boat.

              RaymondM wrote:

              I still fail to see why I have to go through all this, but not for AddFontResource

              AddFontResource[^] was included in the VC6 header distribution. AddFontResourceEx [^]is available in Windows 2000 and above and the header file was updated in the Platform SDK. The declaration for AddFontResourceEx [^]is preceeded by:#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
              So you would need: 1.) A header file with the AddFontResourceEx declaration. 2.) Declare a windows version greater or equal to _WIN32_WINNT_WIN2K. Best Wishes, -David Delaune

              modified on Tuesday, January 27, 2009 3:19 AM

              R Offline
              R Offline
              RaymondM
              wrote on last edited by
              #6

              >>"I can't believe that you went this many years without it" (PlatformSDK). I don't know why you think that I do not already have the headers, since they come with the full installation of Microsoft Visual Studio .NET 2003, including its PlatformSDK. In wingdi.h I find the condition _WIN32_WINNT >= 0x0500, which is obviously satisfied in the XP that I am using. From I see that for XP _WIN32_WINNT = 501 So I only need to add #define _WIN32_WINNT 501 before windows.h, and then I can call the function I need. That is of course the only point that I had overlooked. Raymond Mercier

              L 1 Reply Last reply
              0
              • R RaymondM

                >>"I can't believe that you went this many years without it" (PlatformSDK). I don't know why you think that I do not already have the headers, since they come with the full installation of Microsoft Visual Studio .NET 2003, including its PlatformSDK. In wingdi.h I find the condition _WIN32_WINNT >= 0x0500, which is obviously satisfied in the XP that I am using. From I see that for XP _WIN32_WINNT = 501 So I only need to add #define _WIN32_WINNT 501 before windows.h, and then I can call the function I need. That is of course the only point that I had overlooked. Raymond Mercier

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                RaymondM wrote:

                I don't know why you think that I do not already have the headers

                Because you told me that you were compiling the project with VC6.

                RaymondM wrote:

                So I only need to add #define _WIN32_WINNT 501 before windows.h, and then I can call the function I need. That is of course the only point that I had overlooked.

                Exactly what I stated in my last response. I am happy to hear that you have corrected the problem. Best Wishes, -David Delaune

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups