Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

VFP IMAGING



IMPORTANT FIX FOR SAMPLES USING GRADIENTS

Unfortunately, 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."
http://msdn2.microsoft.com/en-us/library/ms978941(VS.80).aspx


GRADOBJECTS CLASS
I've just published the newest version of the class, that can be downloaded from this link. http://weblogs.foxite.com/files/cesarchalom/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.
http://www.codeplex.com/VFPX/WorkItem/View.aspx?WorkItemId=7358

 

ALL GDIPLUS DECLARATIONS:
Craig Boyd has a fantastic post in which he brings all 603 GDI+ declarations.
http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,d06cf377-c9ba-4eeb-93aa-b98ac115e895.aspx
They work perfectly, but take care to add a ".DLL" after each declaration if you plan to use GDI+ using direct API calls.


SORRY AGAIN
I'm really sorry for all the inconveniences caused, and thank you all again for all the feedback and very important support this great community has been providing to me.

Published Wednesday, January 24, 2007 2:27 PM by cesarchalom
Filed Under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ana María Bisbé said:

Versión en Español de este artículo en / Spanish version at http://www.portalfox.com/article.php?sid=2355
July 24, 2007 7:22 PM
 

Michael Babcock said:

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:

http://msdn2.microsoft.com/en-us/library/ms978941(VS.80).aspx

I've updated the article too.

Regards

Cesar

October 24, 2007 5:48 PM

What do you think?

(required) 
(optional)
(required) 

This Blog

Post Calendar

<January 2007>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Syndication