|
-
Jul 5th, 2008, 10:22 AM
#1
Thread Starter
Lively Member
[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?
-
Jul 5th, 2008, 10:30 AM
#2
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.
-
Jul 5th, 2008, 06:30 PM
#3
Frenzied Member
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
-
Jul 6th, 2008, 05:54 AM
#4
Thread Starter
Lively Member
Re: Load a url into a picture box?
Thanks guys. easy as...
I rated both of you 
thanks again
-
Jul 6th, 2008, 08:33 AM
#5
Re: [RESOLVED] Load a url into a picture box?
-
Jul 9th, 2008, 01:30 PM
#6
Frenzied Member
Re: Load a url into a picture box?
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|