Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Webbrowser - how to save image (jpg)
Message
 
À
18/06/2013 07:42:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01576604
Message ID:
01576836
Vues:
49
The easiest way to save an image is to just download it using an HTTP client. While you can screw around with trying to find the image in the temporary internet explorer cache that's very problem prone - you may not have the rights to access that folder or there may be multiple files of the same name there etc.

You can use the UrlDownloadToFile API in Windows to easily download a file to where you need it to:
DECLARE LONG URLDownloadToFile IN URLMON.DLL ;
			LONG, STRING, STRING, LONG, LONG
lnResult = URLDownloadToFile(0, "http://west-wind.com/images/wwlogo.gif", "c:\temp\wwlogo.gif", 0, 0)
IF lnResult # 0
   ? "Failed"
ENDIF   
Or if you need something a little more sophisticated (like if authentication is involved) you can look at the wwHttp class in West Wind Client Tools:
loHttp = CREATEOBJECT("wwHttp")

*** Directly download into string/binary stream you can use in Fox
*** Options also allow downloading to file directly
lcFile = loHttp.HttpGet("http://west-wind.com/images/wwlogo.gif")

STRTOFILE(lcFile,"c:\temp\wwlogo.gif")
Hope this helps,

+++ Rick ---

>Hi !
>After a long period...
>
>I'm using webbrowser for quite a while, but this is the first time I need to save an image (jpg) to disk.
>I have this image in the webbrowser screen and I wonder how to programmatically save it to disk.
>
>Looking forward for any help.
>Thanks
>Dany
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform