Solved

Compatabilty issues with gdiplus & foxpro under windows 7

Posted on 2010-09-19
20
1,373 Views
Last Modified: 2012-05-10
Are there any known compatability issues with GDIPLUS and VFP under windows 7?
We have a program that stores a bitmap to a blob and then renders it to a form. This form works perfectly under
windows xp, and displays the bitmap using the picturerval property of an image control. However, we cannot get it to run
under windows 7.
There is no problem with the creation of the bitmap - because we can create it under windows 7 and display the result in windows XP...the problem is displaying it under windows 7

Any help would be greatly appreciated.

Cheers,

Eylon
0
Comment
Question by:EylonM
  • 8
  • 5
  • 4
  • +2
20 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33711756
What is the concrete problem, do you get an error message and if what, is the image not displaye at all, is it displayed wrong?

Bye, Olaf.
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 33711765
Maybe it's the temporary location of the files. Change it to c:\users\<username>

cTempPath = TempDirectory() + ADDBS("ApplicationName")
IF NOT DIRECTORY(cTempPath)
      MD (cTempPath)
ENDIF


FUNCTION TempDirectory
LOCAL cBuff, nLen
DECLARE INTEGER GetTempPath IN kernel32 INTEGER, STRING @
cBuff = SPACE(255)
nLen = GetTempPath(LEN(cBuff),@cBuff)
CLEAR DLLS
RETURN ALLTRIM(LEFT(cBuff,nLen))
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33711767
What is the concrete problem? Do you get an error message and if what message? Is the image not displayed at all? is it displayed wrong?

Bye, Olaf.
0
 

Author Comment

by:EylonM
ID: 33711917
There is no error message.  I am attaching a form + simple data.  When run under windows xp it displays the data, when run under windows 7 it diaplays a grey background.
Unfortunately - it won't allow me to upload the files
Thanks,
Eylon
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 33711921
You may try the following code. It should help to investigate your problem
LOCAL lcFile

lcFile = GETFILE("BMP,JPG,ICO,PNG", "Select Image file")



IF EMPTY(lcFile) OR !FILE(lcFile)

  WAIT WINDOW "File does not exist"

  RETURN

ENDIF



LOCAL loForm AS Form 

loForm = CREATEOBJECT("MyForm")



WITH loForm

  .AddObject("MyImage","Image")

  .Autocenter = .T.

  .Visible = .T.

  .Caption = "Temp. folder: " + SYS(2023)

  

  WITH .MyImage

    .Top = 10

    .Left = 10

    .Width = .Parent.Width - 20

    .Height = .Parent.Height - 20

    .Stretch = 1

    .Anchor = 15

    .PictureVal = FILETOSTR(lcFile)

    .Visible = .T.

  ENDWITH



ENDWITH



READ EVENTS





DEFINE CLASS MyForm AS Form



PROCEDURE Destroy

  CLEAR EVENTS

ENDPROC



ENDDEFINE

Open in new window

0
 
LVL 41

Expert Comment

by:pcelba
ID: 33711927
Add one more extension (e.g.  .TXT) to all your files.
0
 

Author Comment

by:EylonM
ID: 33712239
Yes, but I want the reportlistener to take the data from the blob in a table, and not from a file.  This worked with windows xp
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33712256
I don't see any difference. The code was provided for tests under W7 and it can be updated to accept a blob field contents. I've been testing it under W7 Ultimate 64 bit + VFP 9 SP2 (09.00.0000.7423).

You still may upload your test form (with additional .TXT extension). I am waiting for it.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33712288
What kind of pictures are you using. There were and still may be som problems with PNG. Anyway, what you create with gdiplus from scratch should be renderable with gdiplus again, and both vfp forms and reports are drawn by gdiplus.

I've also seen VFP having problems with high color ICO files with PNG like alpha channel, which extracted to PNG with Gimp worked again, but that problem was not limited to Win7.

Bye, Olaf.
0
 

Author Comment

by:EylonM
ID: 33712341
OK, I think we're getting somewhere...
I got the form  to run under windows 7 when I saved the blob to a file, and then set the picture property of the image to the filename (not the pictureval property).
(I'm indebted to Cetin Basoz & Sergey Berezniker on the UT for this idea)

Now it shows properly in win 7.
In windows XP there was no need for this manoeuvring.

 Now I have to fix the reportlistener class...

Thanks Olaf & everybody
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:EylonM
ID: 33712350
Oops, and thanks to Pcelba - I didn't notice his solution - so he really solved it here!
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33712368
I would say to create the file is not necessary. To assign the filename to Picture property is same as to assign the file contents (or blob field contents) into PictureVal property.
0
 
LVL 14

Expert Comment

by:tusharkanvinde
ID: 33713866
Do you have the latest VFP service pack for both development and runtime files.
0
 

Author Comment

by:EylonM
ID: 33713950
Pcelba, this is exactly what is not working in windows 7.  In xp I could set the pictureval property and display the picture.  In windows 7 I had to create a file and set the picture property!
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 33713974
Try to put the compatibility to XP on the application and see if it works. Right Click on the exe then Properties.
0
 

Author Comment

by:EylonM
ID: 33747466
Unfortunattely, this didn't work...so much for compatibility
0
 

Author Closing Comment

by:EylonM
ID: 33747510
The solution is correct.  Unfortunately it seems that gdi under windows 7 does not recognise the pictureval property if it is set to a memory variable, and makes us  use the picture property, which forces one to save the picture to a file and set the picture property to this file.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33751387
Rrelated to the issue: http://weblogs.foxite.com/vfpimaging/archive/2007/04/10/3669.aspx
So you're better off using Picture vs PictureVal anyway.

Bye, Olaf.

0
 

Author Comment

by:EylonM
ID: 33751896
Well, maybe...but using the pictureval property meant I don;t need to create a file, display it and subsequently erase it... and to expect MS to fix the pictureval property would be way out of line...Thanks anyway!
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33752115
Unfortunately, we know about VFP errors.

Fortunately, each particular thing is possible to do several different ways...

And I believe the next release will be better again. :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now