A strange error occured for some people when using some of the samples for the creation of gradients that I've been providing in this blog.

Some people reported that the original code was creating a black image instead of a gradient. in other cases, the error "cannot load 32-bit dll gdiplus" occured.

This happened because vfp was using different versions of gdiplus.dll installed on the machine. one version to draw the gradient and another version to draw just the gradients. if the machine had only one version of gdiplus.dll installed, even with more than one copy, all went ok. but some applications need a specific version of this library, and ms has already released more than 5 versions till this moment. after a long time testing i detected this using a simple "display dlls" command.

Special thanks to all people that reported this error, tested and helped to find the origin, specially to: Andrew Mcneill, Emerson Reed, Sergey Berezniker, Rui Nogueira, Randy Pearson, Sacchi. I can't forget the more than 70 people from my home, the brazilian foxbrasil community that very kindly tested many codes in different environments.

the fix:
we were using:
declare gdip..... in gdiplus etc etc

The correct is to change from "in gdiplus" to "in gdiplus.dll". on certain machines, this is causing some confusions, and makes vfp use more than one version, specially if the user already uses _gdiplus.vcx or the reportlistener.

Note that vfp declares gdiplus using ".dll" for its internal commands, and also in _gdiplus.vcx

In vfp9's help we can find:
"to ensure that you use the correct copy of gdiplus.dll, use the syntax in gdiplus.dll with no explicit path in your declare dll statements."

gradobjects class
I've just published the newest version of the class, that can be downloaded from this link. http://weblogs.foxite.com/files/vfpimaging/gradobjects/gradobjects.zip
i also hope to publish a new post explaining all the new features, fixes and samples, but for the moment, this version will help to eliminate the bug.

old posts
I've also updated all previous posts

gradient objects with gdi+ revisited

gradient backgrounds in your forms with gdi+ part2

gradient backgrounds in your forms with gdi+

outlook bar 2003:
The same problem could occur using this tremendous class. to fix it, please open the file outlook2003bar.vcx, select the class "outlook2003bar". sorry emerson !

In method "creategradientimage", please add a ".dll" in the declaration of the gradient gdi+ function, like this:

* declare api
declare long gdipcreatelinebrushi in gdiplus.dll ;
   string point1, string point2, ;
   long color1, long color2, ;
   long wrapmode, long @linegradient

Gdiplusx library
The whole library will receive this update too.
Hopefully, on the next release - 0.07 alpha we'll add this fix and some other features and cool new samples.


All gdiplus declarations:
Craig Boyd has a fantastic post in which he brings all 603 gdi+ declarations.
They work perfectly, but take care to add a ".dll" after each declaration if you plan to use gdi+ using direct api calls.


  1. Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2355

  2. The microsoft link above yields a "location not found (404)" message. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_foxhelp9/html/e11b3ffe-ee6b-4af3-94f8-7a5ed30ea83d.asp)
    Hi Michael,
    Thanks for reporting the bad link.
    MS changed the documentation links for SP2, so now the correct is:
    I've updated the article too.