Sunday, June 17, 2012

Contoh Menggunakan Proxy Pada Internet Transfer Control

Private Sub Command1_Click()
Inet1.AccessType = icNamedProxy
Inet1.Proxy = "ftp=ftp://ftp-gw"
Inet1.URL = "ftp://ftp.microsoft.com"
Inet1.Execute , "DIR"
End Sub

Private Sub Command2_Click()
Inet2.AccessType = icNamedProxy
Inet2.Proxy = "http://proxy:80"
MsgBox Inet1.OpenURL("http://www.microsoft.com")
End Sub

Private Sub Command3_Click()
Inet3.AccessType = icNamedProxy
Inet3.Proxy = "ftp=ftp://ftp-gw http=http://itgproxy:80"
MsgBox Inet2.OpenURL("http://www.microsoft.com")
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim vtData As Variant
Select Case State
Case icResponseCompleted
Open "c:\temp\output.txt" For Binary Access Write As #1

vtData = Inet1.GetChunk(1024, icString)

Do While LenB(vtData) > 0
Put #1, , vtData
vtData = Inet1.GetChunk(1024, icString)
Loop
Put #1, , vtData
Close #1
End Select
End Sub