Results 1 to 9 of 9

Thread: A little help please...

  1. #1

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519

    Talking 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".

  2. #2
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    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

  3. #3

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  4. #4
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    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

  5. #5

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  6. #6
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    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.

  7. #7
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    I quite like the UrlDownloadToFile api for this kind of thing
    VB Code:
    1. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _    
    2.     "URLDownloadToFileA" (ByVal pCaller as Long, _    
    3.     ByVal szURL as String, _    
    4.     ByVal szFileName as String, _    
    5.     ByVal dwReserved as Long, _    
    6.     ByVal lpfnCB as Long) as Long    
    7.  
    8. Public Function DownloadFile(URL as String, _    
    9.     LocalFilename as String) as Boolean    
    10.     Dim lngRetVal as Long    
    11.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)    
    12.     If lngRetVal = 0 Then DownloadFile = True    
    13. End Function    
    14.  
    15. 'Usage:
    16. DownloadFile "http://www.myserver.com/myfile.txt", "c:\myfile.txt"

  8. #8

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  9. #9
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    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
  •  



Click Here to Expand Forum to Full Width