Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

82 users online



VB - LoadPicture() for web images

VB - LoadPicture() for web images

Currently viewing this thread: 1 (0 members and 1 guests)


PlagueAJ

PlagueAJ

Status: Offline!

VB - LoadPicture() for web images

okay well first off my code:

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/

Xaimoatse

Xaimoatse

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:

Code:


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 | http://www.dark-storm.com/n-unit.png | UT or die

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0068 seconds.