Rabu, 25 Mei 2011

Load Gambar dari Internet

Buat sebuah Form dengan sebuah kontrol PictureBox dan sebuah kontrol CommandButton didalamnya. Lalu ketikkan kode berikut di bagian 'Command1_Click' :

Dim b() As Byte
Dim whr As Object
Set whr = CreateObject("WinHttp.WinHttpRequest.5.1")

whr.Open "GET", "http://www.google.com/intl/id/images/logo.gif", False
whr.Send

Open "temp.tmp" For Binary As #1
b() = whr.ResponseBody
Put #1, 1, b()
Close #1

Picture1.Picture = LoadPicture("temp.tmp")

Tidak ada komentar:

Posting Komentar