|
-
Jun 3rd, 2003, 12:07 PM
#1
Thread Starter
Frenzied Member
A little help please...
How would I go about grabbing a picture from a web page programaticly..
Example,
I want to grab the chart for kmart's stock prices..
Kmarts stock chart
to be displayed in a picture box...
Thanks in advance for the help..
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jun 3rd, 2003, 12:10 PM
#2
Addicted Member
You can access the picture using it's full URL
http://chart.yahoo.com/c/1y/k/kmrt.ob.gif
as long as all you want is that picture
Place Your VBForums Ad Here
-
Jun 3rd, 2003, 02:25 PM
#3
Thread Starter
Frenzied Member
Thanks! Thats exactly what I want. How can I save it for later? Or, is it possible to have a picture box direclt linked to the picture?
Thanks again for the help,
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jun 3rd, 2003, 02:34 PM
#4
Addicted Member
This isn't exactly VB related, and you should always double check with copyrights and all that good stuff when using a picture from someone else's website. With that in mind, all you really need to do is right-click on the picture and click Save Picture As... or something similar and then it's right there on your machine, ready to be accesssed.
Place Your VBForums Ad Here
-
Jun 3rd, 2003, 02:35 PM
#5
Thread Starter
Frenzied Member
ok, but I want to be able to do it programaticly.. Without user intervention...
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jun 3rd, 2003, 06:10 PM
#6
Frenzied Member
Use winsock and preform a basic GET on the address of the image, you then can load the picture into an image.
That's the fun way, if you want to cheat use the webbrowser control and navigate to the image address.
-
Jun 3rd, 2003, 06:30 PM
#7
Frenzied Member
I quite like the UrlDownloadToFile api for this kind of thing 
VB Code:
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
'Usage:
DownloadFile "http://www.myserver.com/myfile.txt", "c:\myfile.txt"
-
Jun 4th, 2003, 08:47 AM
#8
Thread Starter
Frenzied Member
TomGibbons,
That was perfect! Thanks alot!
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jun 4th, 2003, 09:09 AM
#9
Frenzied Member
You're welcome
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|