Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP6, photos and Windows 7

Status
Not open for further replies.

theactpro

Technical User
Jan 22, 2009
7
US
A client has a simple VFP 6 membership app where a photo can be uploaded. It worked fine in XP Pro. Now they moved it over to a Windows 7 machine and just a thumbnail of the photo displays on the screen form. I manually typed in the "append general photo from &photosource" in the command window and when I double click on the Gen field, sure enough, only a thumbnail of the photo appears. Can photos not be appended into General fields in VFP 6 using Win7?
 
Since I don't use general fields (and don't recommend ever using them), I can't answer your specific question.

Just wanted to point out that sooner or later, this line:

append general photo from &photosource

is going to get you in trouble. Never use a macro where a name expression will do, especially when file paths are involved. Change it to:

append general photo from (photosource)

and it'll work even with spaces in the path.

Tamar
 
Tamar, thanks so much for your reply. (You know we once met many years ago!) However, that still didn't work. Even changing the code to use the name expression still yields a small icon with photo file name in the field instead of the photo itself. Am I missing something? Thanks.
 
the problem is that by using a general field you are relying on there being an OLE server configured in windows to display the photo.

If, in windows explorer, you right click on the jpg/bmp/gif, open with and select ms paint to always open this file it should work. Until that is another program comes along and associates itself with jpg/bmp/gif files.

For this reason general fields for photos are not a good idea (plus bloating of your fpt file).

You would be MUCH better off either

1. using filetostr() to copy the file into a binary memo field, then when you want to display it use strtofile() to create a temporary file and use the image control to display it. (In VFP9 you can use the pictureval property to bind the memo field to the image control and save having to copy the file out of the memo field and into a temp file.)

2. copy the photo into an images folder below your main data folder and save the relative path and filename in your table. Again use the image control to display the file by setting the picture property to the filename.

hth

Nigel



 
However, that still didn't work. Even changing the code to use the name expression still yields a small icon with photo file name in the field

Tamar's suggestion (of using a name expression rather than a macro) wasn't intended to solve the problem of the icon - as she herself said at the start of her post.

She was simply pointing out another problem in your code, and giving you some good advice on how to avoid it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Try looking at this thread

thread184-1244772

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Griff,

I reviewed that link and followed the specified steps. All photos in the folder are linked to MS Paint. Didn't work. After the code changes, I still get the thumbnail icon and the file name instead of the photo itself. Are there any other remedies? I'm not really sure the client will want to pay for an upgrade to VFP 9. Stumped.
 
It's not VFP (the version anyway) it is the client OS and the association with MS Paint.

Painful, isn't it.



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
I just double checked, and that is the solution I distribute with my apps - certainly the one I have been distributing for a while now - and I haven't had to intervene manually for any users in a few years now.

This would be clients up to XP




Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
After fiddling with this for several more hours, I wondered if it really was just an operating system difference. I related every photo in my photos folder with the paint program included with Windows 7.

So I installed an old copy of Corel Paint Shop Pro X on the Windows 7 machine. Voila! That did it! During the installation it asks if all graphic file types should be opened with PSP X. I appended a photo into the VFP 6 database and the photo was embedded successfully!

Thanks to all who responded and helped.

(BTW, not having a bloat problem since there are less than 100 records in this database.)
 
Win7 does not include Paint anymore. It cannot work anymore on Win7. Get away from the general field as picture storage.

Bye, Olaf.
 
Olaf,
I agree with what you are saying except "win7 doesn't include Paint". Win7 64 bits have Paint, I guess also 32 bits does.

Cetin Basoz
MS Foxpro MVP, MCP
 
Sorry, my error.

I just thought so because of all the talk about Paint.NET
Paint was and is providing the OLE server and OLE class Paint.Picture to which the general fields are associated to display their content with in an Olecontrol.

So if Paint still is part of Win7, it at least lacks that or the default association changed.

You might try at a DOS prompt: ASSOC .BMP=Paint.Picture

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top