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. How to dynamically load GdiPlus.dll?

How to dynamically load GdiPlus.dll?

Scheduled Pinned Locked Moved C / C++ / MFC
winformsgraphicstutorialquestionlearning
11 Posts 5 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.
  • C Offline
    C Offline
    Cyrus Dang
    wrote on last edited by
    #1

    Dear all, I'm using some GDI+ functions in my project. Is there any way to let my program start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)? By other words, I want to load this dll dynamically. If file gdiplus.dll is unavailable, some functionalities will be disabled and the program should start normally. Thanks in advance. Regards,

    M J 2 Replies Last reply
    0
    • C Cyrus Dang

      Dear all, I'm using some GDI+ functions in my project. Is there any way to let my program start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)? By other words, I want to load this dll dynamically. If file gdiplus.dll is unavailable, some functionalities will be disabled and the program should start normally. Thanks in advance. Regards,

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      Refer to LoadLibrary as mentioned in this article[^].


      Maxwell Chen

      C 1 Reply Last reply
      0
      • M Maxwell Chen

        Refer to LoadLibrary as mentioned in this article[^].


        Maxwell Chen

        C Offline
        C Offline
        Cyrus Dang
        wrote on last edited by
        #3

        Thanks, Do you know any articles explicitly written about using GDI+ dynamically? Regards,

        M 1 Reply Last reply
        0
        • C Cyrus Dang

          Dear all, I'm using some GDI+ functions in my project. Is there any way to let my program start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)? By other words, I want to load this dll dynamically. If file gdiplus.dll is unavailable, some functionalities will be disabled and the program should start normally. Thanks in advance. Regards,

          J Offline
          J Offline
          Jun Du
          wrote on last edited by
          #4

          Tuan Dang wrote:

          start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)?

          With or without GDI+, your app should start peacefully. You probably don't want to load GDI+ dynamically, as GDI+ (like GDI) is pretty much a programming model. Although you may mix GDI with GDI+ to some extent, people usually avoid doing so. Unless there is some absolute reason that you have to mix them together, a good practice is to load GDI+ statically. This way it won't create any complexity to your app. - It's easier to make than to correct a mistake.

          B C 2 Replies Last reply
          0
          • C Cyrus Dang

            Thanks, Do you know any articles explicitly written about using GDI+ dynamically? Regards,

            M Offline
            M Offline
            Maxwell Chen
            wrote on last edited by
            #5

            This one[^]...


            Maxwell Chen

            1 Reply Last reply
            0
            • J Jun Du

              Tuan Dang wrote:

              start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)?

              With or without GDI+, your app should start peacefully. You probably don't want to load GDI+ dynamically, as GDI+ (like GDI) is pretty much a programming model. Although you may mix GDI with GDI+ to some extent, people usually avoid doing so. Unless there is some absolute reason that you have to mix them together, a good practice is to load GDI+ statically. This way it won't create any complexity to your app. - It's easier to make than to correct a mistake.

              B Offline
              B Offline
              bob16972
              wrote on last edited by
              #6

              Jun Du wrote:

              people usually avoid doing so

              That's quite a statement to make. Do you think you just made that up? Maybe? :confused:

              J 1 Reply Last reply
              0
              • B bob16972

                Jun Du wrote:

                people usually avoid doing so

                That's quite a statement to make. Do you think you just made that up? Maybe? :confused:

                J Offline
                J Offline
                Jun Du
                wrote on last edited by
                #7

                If you think people should mix GDI and GDI+ in their design, make an argument why you think so. I've used both a lot and it's certainly debatable. - It's easier to make than to correct a mistake.

                1 Reply Last reply
                0
                • J Jun Du

                  Tuan Dang wrote:

                  start peacefully if file gdiplus.dll is not available (of course, some functionalities should be disabled)?

                  With or without GDI+, your app should start peacefully. You probably don't want to load GDI+ dynamically, as GDI+ (like GDI) is pretty much a programming model. Although you may mix GDI with GDI+ to some extent, people usually avoid doing so. Unless there is some absolute reason that you have to mix them together, a good practice is to load GDI+ statically. This way it won't create any complexity to your app. - It's easier to make than to correct a mistake.

                  C Offline
                  C Offline
                  Cyrus Dang
                  wrote on last edited by
                  #8

                  Jun Du wrote:

                  With or without GDI+, your app should start peacefully.

                  Is it true? When starting in Windows 2000 (in which gdiplus.dll is unavailable), my program caused an error saying that "The dynamic link library gdiplus.dll could not be found in the specified path...". Then it terminated. With that error, I don't think we can say the program starts peacefully. My question is that do we have any ways to smartly use GDI+ functions only when its DLL is avaialabe. Otherwise, all program's functionalities related to GDI+ should be quietly and programmatically disabled. I realize that whether the GDI+ functions are actually called or not, file gdiplus.dll is always required. Thanks y'all. Unfortunately, my problem has still unsolved yet. Regards,

                  J 1 Reply Last reply
                  0
                  • C Cyrus Dang

                    Jun Du wrote:

                    With or without GDI+, your app should start peacefully.

                    Is it true? When starting in Windows 2000 (in which gdiplus.dll is unavailable), my program caused an error saying that "The dynamic link library gdiplus.dll could not be found in the specified path...". Then it terminated. With that error, I don't think we can say the program starts peacefully. My question is that do we have any ways to smartly use GDI+ functions only when its DLL is avaialabe. Otherwise, all program's functionalities related to GDI+ should be quietly and programmatically disabled. I realize that whether the GDI+ functions are actually called or not, file gdiplus.dll is always required. Thanks y'all. Unfortunately, my problem has still unsolved yet. Regards,

                    J Offline
                    J Offline
                    Jun Du
                    wrote on last edited by
                    #9

                    I think I know your situation better now. The issue should be resolveable.

                    Tuan Dang wrote:

                    Jun Du wrote: With or without GDI+, your app should start peacefully. Is it true?

                    Yes. It's your respossibility to handle this more properly.

                    Tuan Dang wrote:

                    When starting in Windows 2000 (in which gdiplus.dll is unavailable), my program caused an error saying that "The dynamic link library gdiplus.dll could not be found in the specified path...". Then it terminated. With that error, I don't think we can say the program starts peacefully.

                    If the app was linked to gdiplus.lib, it will look for the corresponding DLL at the start-up. That's how it works. You've already realized that, as you stated in the following:

                    Tuan Dang wrote:

                    I realize that whether the GDI+ functions are actually called or not, file gdiplus.dll is always required.

                    But even you dynamically load the DLL, your app has no clue whether the DLL is present or not.

                    Tuan Dang wrote:

                    My question is that do we have any ways to smartly use GDI+ functions only when its DLL is avaialabe. Otherwise, all program's functionalities related to GDI+ should be quietly and programmatically disabled.

                    Yes. I can think of two options: 1) Include gdiplus.dll in your final deliverables. I've noticed many venders do this and a couple of CP articles do so as well. 2) Add code to check if gdiplus.dll exists in the target computer. I remember it's part of Platform SDK for Winows 2000 (SDK 2003?). To guarantee that you can load, you also may include in the documentation that the target machine must have a recent Platform SDK installed. Hope this helps. - It's easier to make than to correct a mistake.

                    B J 2 Replies Last reply
                    0
                    • J Jun Du

                      I think I know your situation better now. The issue should be resolveable.

                      Tuan Dang wrote:

                      Jun Du wrote: With or without GDI+, your app should start peacefully. Is it true?

                      Yes. It's your respossibility to handle this more properly.

                      Tuan Dang wrote:

                      When starting in Windows 2000 (in which gdiplus.dll is unavailable), my program caused an error saying that "The dynamic link library gdiplus.dll could not be found in the specified path...". Then it terminated. With that error, I don't think we can say the program starts peacefully.

                      If the app was linked to gdiplus.lib, it will look for the corresponding DLL at the start-up. That's how it works. You've already realized that, as you stated in the following:

                      Tuan Dang wrote:

                      I realize that whether the GDI+ functions are actually called or not, file gdiplus.dll is always required.

                      But even you dynamically load the DLL, your app has no clue whether the DLL is present or not.

                      Tuan Dang wrote:

                      My question is that do we have any ways to smartly use GDI+ functions only when its DLL is avaialabe. Otherwise, all program's functionalities related to GDI+ should be quietly and programmatically disabled.

                      Yes. I can think of two options: 1) Include gdiplus.dll in your final deliverables. I've noticed many venders do this and a couple of CP articles do so as well. 2) Add code to check if gdiplus.dll exists in the target computer. I remember it's part of Platform SDK for Winows 2000 (SDK 2003?). To guarantee that you can load, you also may include in the documentation that the target machine must have a recent Platform SDK installed. Hope this helps. - It's easier to make than to correct a mistake.

                      B Offline
                      B Offline
                      bob16972
                      wrote on last edited by
                      #10

                      Jun Du wrote:

                      target machine must have a recent Platform SDK installed

                      That's absurd!:doh: The GDI+ redistributable for pre-XP boxes can be found at GDI+ Redistributable[^] It's a slight bit smaller methinks

                      1 Reply Last reply
                      0
                      • J Jun Du

                        I think I know your situation better now. The issue should be resolveable.

                        Tuan Dang wrote:

                        Jun Du wrote: With or without GDI+, your app should start peacefully. Is it true?

                        Yes. It's your respossibility to handle this more properly.

                        Tuan Dang wrote:

                        When starting in Windows 2000 (in which gdiplus.dll is unavailable), my program caused an error saying that "The dynamic link library gdiplus.dll could not be found in the specified path...". Then it terminated. With that error, I don't think we can say the program starts peacefully.

                        If the app was linked to gdiplus.lib, it will look for the corresponding DLL at the start-up. That's how it works. You've already realized that, as you stated in the following:

                        Tuan Dang wrote:

                        I realize that whether the GDI+ functions are actually called or not, file gdiplus.dll is always required.

                        But even you dynamically load the DLL, your app has no clue whether the DLL is present or not.

                        Tuan Dang wrote:

                        My question is that do we have any ways to smartly use GDI+ functions only when its DLL is avaialabe. Otherwise, all program's functionalities related to GDI+ should be quietly and programmatically disabled.

                        Yes. I can think of two options: 1) Include gdiplus.dll in your final deliverables. I've noticed many venders do this and a couple of CP articles do so as well. 2) Add code to check if gdiplus.dll exists in the target computer. I remember it's part of Platform SDK for Winows 2000 (SDK 2003?). To guarantee that you can load, you also may include in the documentation that the target machine must have a recent Platform SDK installed. Hope this helps. - It's easier to make than to correct a mistake.

                        J Offline
                        J Offline
                        James Brown
                        wrote on last edited by
                        #11

                        3. delay-load the gdi+ DLL and only call gdi+ functions when on xp
                        http://www.catch22.net

                        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