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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save web image

Status
Not open for further replies.

DavidAWH

Programmer
Nov 4, 2001
16
AU
Hi Guys

I need to save an image from a Webbrowser control to the hard drive of the local computer. The image is the only object on the web page returned

I was trying to do this by emulating a right click on the window and selecting "save image as" but have had no luck so far

Would anyone know how i could save this image

:)
 
Thanks strongm

I had tried something similar but had no luck. The code in question returns static images that are embedded in the webpage, but seems to have trouble with dynamic images that change, depending on the parameters pass.

The image I am trying to save can be found with the following link


I change x and y co-ordinates to get different images
 
The above link actually returns a GIF image, without embedding it in HTML. Thats why strongm's code is not working.

Given the URL, you can download a file and save it to disk with Microsoft Internet Transfer Control or URLDownloadToFile function. See thread222-757916.

You can also display the picture directly in a picturebox without saving it to disk. See thread222-708828.
 
Well, actually strongm's code does actually contain the Internet Transfer Control solution ...
 
Thanks Guys

Exactly what I was looking for Hypetia. The URLDownloadToFile function works great

Thanks again
 
One word of warning - URLDownloadToFIle sometimes seems to have problems bypassing the IE cache even if the poorly documented dwReserved is set to BINDF_GETNEWESTVERSION (so you don't always get the latest version of the file, and you never get it if dwReserved is set to 0&).

For some applications this may be a bad thing, in which case you might also want to look at the DeleteUrlCacheEntry API call

Note:
BINDF_GETNEWESTVERSION = &H10
 
Guys

Can i set a proxy server in my app to use with URLDownloadToFIle function and an inet control

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top