
December 20th, 2003
04:44 AM
VB - LoadPicture() for web images
okay well first off my code:
Pic(Selected2).Picture = LoadPicture(ImageSources(Selected2))
everything works as long as its an image on my hard drive, how could i get it to work for web images ?
please and thank you =D
edit: an example of a web image is http://www.google.com/banner.jpg
___________________
:: Administrator of http://www.develoWEB.tk/

December 20th, 2003
05:39 AM
WHAT HAVE YOU DONE
Status: Offline!
You could cache the image using the Winsock control, and then load the temporary image via LoadImage.
So, something like:
Private Sub Form_Load()
inet.Execute "http://url/heyanimage.bmp", "GET"
End Sub
Private Sub inet_StateChanged(ByVal State As Integer)
Dim data As Variant
filenum = FreeFile()
Select Case State
Case icResponseCompleted
Open "lookatmahrandom.bmp" For Binary Access Write As filenum
data = inet.GetChunk(1024, icByteArray)
Do While LenB(data) > 0
Put filenum, , vtData
data = inet.GetChunk(1024, icByteArray)
Loop
Put filenum, , data
Close filenum
pic.Picture = LoadPicture("lookatmahrandom.bmp")
End Select
End Sub
Although, it'd only work for bitmaps. I searched around for a way to decode compressed images and ended up with this: http://www.visualbasicforum.com/t77960.html
___________________
Sykil |
| UT or die