Results 1 to 6 of 6

Thread: [RESOLVED] Load a url into a picture box?

  1. #1

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Resolved [RESOLVED] Load a url into a picture box?

    Just as the name says, how do I load an image, that is online, into my Picture box?

    REMEMBER TO RATE

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Load a url into a picture box?

    Hai feneck,

    URLDownloadToFile() API is you require.

    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
    Private Sub Form_Load()
        'example by Matthew Gates ([email protected])
        DownloadFile "http://www.allapi.net", "c:\allapi.htm"
    End Sub
    replace the url with the url to the image
    on the second parameter, you specify the location and a name to save it on your hard drive. form the hard drive, load it in to your picture box.

  3. #3
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Load a url into a picture box?

    Shortened Fazi's code:

    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
        DownloadFile = (URLDownloadToFile(0, URL, LocalFilename, 0, 0) = 0)
    End Function
    Private Sub Form_Load()
        'example by Matthew Gates ([email protected])
        DownloadFile "http://www.allapi.net", "c:\allapi.htm"
    End Sub

  4. #4

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Re: Load a url into a picture box?

    Thanks guys. easy as...
    I rated both of you

    thanks again

    REMEMBER TO RATE

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Load a url into a picture box?

    Tx Feneck!

  6. #6
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Load a url into a picture box?

    Quote Originally Posted by feneck
    Thanks guys. easy as...
    I rated both of you

    thanks again
    Thanks Feneck

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