How to dynamically load GdiPlus.dll?
-
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,
-
Thanks, Do you know any articles explicitly written about using GDI+ dynamically? Regards,
-
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,
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.
-
Thanks, Do you know any articles explicitly written about using GDI+ dynamically? Regards,
-
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.
-
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:
-
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.
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,
-
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,
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.
-
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.
-
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.
3. delay-load the gdi+ DLL and only call gdi+ functions when on xp
http://www.catch22.net