Just as the name says, how do I load an image, that is online, into my Picture box?
Printable View
Just as the name says, how do I load an image, that is online, into my Picture box?
Hai feneck,
URLDownloadToFile() API is you require.
replace the url with the url to the imageCode: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
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.
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
Thanks guys. easy as...
I rated both of you :)
thanks again
Tx Feneck!
Thanks Feneck :thumb:Quote:
Originally Posted by feneck