473,608 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ 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 2964
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(Net Mod,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(NetModul e As Object, PictureURL As String, Img As
Image)
Dim buffer() As Byte
Dim f As Integer
On Error GoTo ErrorTrap
NetModule.Acces sType = icUseDefault
GetPic = 0
f = FreeFile
buffer() = NetModule.OpenU RL(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.Still Executing = True Then
NetModule.Cance l
End If
End Function
"S. Stilwell" <ss******@tampa bay.rr.com> wrote in message
news:N7******** **************@ twister.tampaba y.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******@tampa bay.rr.com> skrev i meddelandet
news:N7******** **************@ twister.tampaba y.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 URLDownloadToFi le Lib "urlmon" Alias
"URLDownloadToF ileA" (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(UR L As String, LocalFilename As String) As
Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFi le(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
'example by Matthew Gates (Pu*****@hotmai l.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
6452
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
10729
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 me to have the option to save the image. I guess I should have seen this coming. On the browser default right click menu there is a "Save Picture As..." option. Does anyone know how I can get that option back, or use another way of saving the...
20
2384
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 used the autoshapes to create this diagram). I was wondering what the best way to incorporate this into the DB. I have read about how saving them as pictures in the DB bloats the size, which is unacceptable, but it needs to be easy to do (not...
0
1365
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 form to which the fields of the table are bound. When the form opens, focus is set in the Bound Object Frame (olePhoto). At this stage of development, I am simply pasting bitmap pictures into the frame and saving them. The problem arises when I...
2
16401
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 object, with g = pictureBox.CreateGraphic, and draw lines g.drawLines(....) But when saving the picture, the new picture have no lines, it is only a copy.
2
2258
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
8110
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 picture of themselves to their profile... I admit that I'm a newbie... but this is how I understand this:
0
1379
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
3314
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 manipulating the Guestbook so that people could enter this information but I want it to were other people will not be able to view the entries like a guestbook. I've never worked with PHP until now and I've missed on every shot so far. I want to...
0
8076
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8020
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
6841
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6020
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5497
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3989
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4050
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2487
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1616
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.