473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Picture at website (saving)

I'm trying to write a small program that will go to a particular web site
and download an image file on a schedule. I just need to know how to save
the file to disk from a website. Any help would be greatly appreciated.
Steve
Jul 17 '05 #1
2 2956
I have a module that does exactly that... the syntax is listed in the
remarks
at the beginning, and it should be easy to implement into a schedule.
1. Add an MS Inet control to the calling form
2. Add an Imagebox to the calling form
3. Create a new module called "Snag", and paste the following into it.

' |
' Syntax: X = Snag.GetPic(NetMod,URL,Img) |
' |
' Requirements: Img As Image |
' URL As String |
' NetMod As Object (MS Inet Ctrl 6) |
' |
' Returns: X As Integer (err number or 0 if none) |
' |

Public Function GetPic(NetModule As Object, PictureURL As String, Img As
Image)
Dim buffer() As Byte
Dim f As Integer
On Error GoTo ErrorTrap
NetModule.AccessType = icUseDefault
GetPic = 0
f = FreeFile
buffer() = NetModule.OpenURL(PictureURL, icByteArray)
Open App.Path + "\PCT.JPG" For Binary Access Write As #f
Put #f, , buffer()
Close #f
Img.Picture = LoadPicture(App.Path + "\PCT.JPG")
Exit Function
'trap the unforseen error here
ErrorTrap:
GetPic = Err
If NetModule.StillExecuting = True Then
NetModule.Cancel
End If
End Function
"S. Stilwell" <ss******@tampabay.rr.com> wrote in message
news:N7**********************@twister.tampabay.rr. com...
I'm trying to write a small program that will go to a particular web site
and download an image file on a schedule. I just need to know how to save
the file to disk from a website. Any help would be greatly appreciated.
Steve

Jul 17 '05 #2
"S. Stilwell" <ss******@tampabay.rr.com> skrev i meddelandet
news:N7**********************@twister.tampabay.rr. com...
I'm trying to write a small program that will go to a particular web site
and download an image file on a schedule. I just need to know how to save
the file to disk from a website. Any help would be greatly appreciated.
Steve


Straight from the API-guide:

Private Declare Function URLDownloadToFile Lib "urlmon" Alias
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As
Long

Public Function DownloadFile(URL As String, LocalFilename As String) As
Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
'example by Matthew Gates (Pu*****@hotmail.com)
DownloadFile "http://www.allapi.net", "c:\allapi.htm"
End Sub
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: daimler | last post by:
help!!!!!!!! i did a for i=1 to picture1.scaleheight/2 picture1.pset (i,i) next i and the pset is shown on the picture
3
by: | last post by:
I have an interactive mapping website where there is a main map image. For the map image, I over-rode the default right click menu to provide a popup menu for mapping tools. Now my client has asked...
20
by: Greg | last post by:
I'm fairly new to access (using 2002) and am setting up a DB for work. along with each record the user also needs to make a flow diagram (previously, these reports were composed in word and they...
0
by: Lyn | last post by:
This one is driving me crazy. I have a table which stores pictures in an OLE Object column, one per record with a few other text fields (caption, date, etc). This table is maintained with a...
2
by: Michael Lehar | last post by:
Hallo I have a pictureBox with a picture loaded from file, then I draw some lines on the picture, and then I want to save the new picture. Befor I can draw lines I have to create a Graphics...
2
by: Cantekin Guneser | last post by:
i am preparing my graduation project, it is website and i need to hep about uploading a picture from client side and insert MSSQL server database. if you can send me example code i would be glad.
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
0
by: picturegoogle | last post by:
Very good picture website http://www.92ee.com Free provides the picture, the animal picture, colored picture,scenery picture, traveling picture, background picture http://www.92ee.com/photo
1
by: OutdoorWorldAdventures | last post by:
I have been trying to do any type of form that my web viewers can submit a picture and story for review to be submited to my website. I use Yahoo Business as my host and everything. I even tried...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.