Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/08/2006, 18:37
luciano
 
Fecha de Ingreso: abril-2004
Mensajes: 192
Antigüedad: 21 años
Puntos: 0
te paso un ejemplo usando el control Intet (lo agregas desde compontes

coloca: un image1, un shape1 y un shape2 y un Command1

Código:
Private Sub Command1_Click()
With Inet1
    .AccessType = icUseDefault
    'Aca pone la ruta de la imagen
    .URL = "http://www.forosdelweb.com/images/vbulletin3_logo_fdw.gif"
    .Execute , "GET"
End With
End Sub

Private Sub Form_Load()
   Command1.Caption = "cargar imagen"
   Shape2.Width = 0
End Sub

Private Sub Form_Resize()
With Shape1
    .Move 0, 10, ScaleWidth, 300
    .BorderColor = vbRed
    .BorderWidth = 3
End With
With Shape2
    .Move 0, 10, 0, 300
    .BackColor = vbBlue
    .BackStyle = 1
End With
    
    
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim vtData As Variant, nomArchivo As String
Dim bDone As Boolean, tempArray() As Byte
nomArchivo = Right(Inet1.URL, Len(Inet1.URL) - InStrRev(Inet1.URL, "/"))

Select Case State
    Case icResponseCompleted
         bDone = False
         filesize = Inet1.GetHeader("Content-length")
         contenttype = Inet1.GetHeader("Content-type")
         
         Open App.Path & "\" & nomArchivo For Binary As #1
         vtData = Inet1.GetChunk(1024, icByteArray)

         DoEvents

         If Len(vtData) = 0 Then
            bDone = True
         End If
            Shape2.Width = 0
    Do While Not bDone

       tempArray = vtData

       Put #1, , tempArray

       Shape2.Width = Shape2.Width + (Len(vtData) * 2) * Shape1.Width / filesize

       vtData = Inet1.GetChunk(1024, icByteArray)
       DoEvents

       If Len(vtData) = 0 Then
          bDone = True
       End If
    Loop

    Close #1

'Cargas la imagen
Image1.Picture = LoadPicture(App.Path & "\" & nomArchivo)

End Select

End Sub


--------------------------------------
__________________
Recursos visual basic