INET problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kapish Kalda

    INET problem

    Hi,
    I am using Inet AcitveX to download a file form Http.(code below) but
    couldnot able to download. The file size is about 2MB.
    Please Suggest.

    Thanks

    Code

    Private Sub Command1_Click( )
    Inet1.Protocol = icHTTP
    Inet1.OpenURL Http://hostname/hi.exe
    Inet1.Execute , "GET Hi.exe c:\Hi.exe"
    End Sub

    Private Sub Inet1_StateChan ged(ByVal State As Integer)
    Const lCHUNKSIZE As Long = 1024
    Dim vtData As Variant ' Data variable.

    Text1.Text = State 'For checking only

    Select Case State
    Case icError ' 11
    vtData = Inet1.ResponseC ode & ":" & _
    Inet1.ResponseI nfo

    Case icResponseCompl eted ' 12
    Dim strData As String: strData = ""
    Dim bDone As Boolean: bDone = False

    ' Get first chunk.
    vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
    DoEvents

    Do While Not bDone

    strData = strData & vtData
    ' Get next chunk.
    vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
    DoEvents

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

    Case icDisconnected
    Debug.Print "* Disconnected"
    Unload Me

    End Select
    End Sub
  • CajunCoiler \(http://www.cajuncoiler.tk\)

    #2
    Re: INET problem

    Looks more like you're attempting FTP than HTTP. The line that
    says: Inet1.Execute , "GET Hi.exe c:\Hi.exe" is a dead giveaway.
    It should be more like: buffer() = Inet1.OpenURL(f ileURL, icByteArray)
    thus GETting the file into byte array "buffer()".

    "Kapish Kalda" <kapish@synergi x.com> wrote in message
    news:914936b0.0 308190301.5c2bd [email protected] gle.com...[color=blue]
    > Hi,
    > I am using Inet AcitveX to download a file form Http.(code below) but
    > couldnot able to download. The file size is about 2MB.
    > Please Suggest.
    >
    > Thanks
    >
    > Code
    >
    > Private Sub Command1_Click( )
    > Inet1.Protocol = icHTTP
    > Inet1.OpenURL Http://hostname/hi.exe
    > Inet1.Execute , "GET Hi.exe c:\Hi.exe"
    > End Sub
    >
    > Private Sub Inet1_StateChan ged(ByVal State As Integer)
    > Const lCHUNKSIZE As Long = 1024
    > Dim vtData As Variant ' Data variable.
    >
    > Text1.Text = State 'For checking only
    >
    > Select Case State
    > Case icError ' 11
    > vtData = Inet1.ResponseC ode & ":" & _
    > Inet1.ResponseI nfo
    >
    > Case icResponseCompl eted ' 12
    > Dim strData As String: strData = ""
    > Dim bDone As Boolean: bDone = False
    >
    > ' Get first chunk.
    > vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
    > DoEvents
    >
    > Do While Not bDone
    >
    > strData = strData & vtData
    > ' Get next chunk.
    > vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
    > DoEvents
    >
    > If Len(vtData) = 0 Then
    > bDone = True
    > End If
    > Loop
    >
    > Case icDisconnected
    > Debug.Print "* Disconnected"
    > Unload Me
    >
    > End Select
    > End Sub[/color]


    Comment

    • news.bellatlantic.net

      #3
      Re: INET problem

      try this, it worked for me.

      Private Sub Command1_Click( )
      Dim file As Byte
      file = Inet1.OpenURL(" Http://hostname/hi.exe", icByteArray)
      Open "C:\Hi.exe" For Binary Access Write As #1
      Put #1, , file
      Close #1
      End Sub


      "Kapish Kalda" <kapish@synergi x.com> wrote in message
      news:914936b0.0 308190301.5c2bd [email protected] gle.com...[color=blue]
      > Hi,
      > I am using Inet AcitveX to download a file form Http.(code below) but
      > couldnot able to download. The file size is about 2MB.
      > Please Suggest.
      >
      > Thanks
      >
      > Code
      >
      > Private Sub Command1_Click( )
      > Inet1.Protocol = icHTTP
      > Inet1.OpenURL Http://hostname/hi.exe
      > Inet1.Execute , "GET Hi.exe c:\Hi.exe"
      > End Sub
      >
      > Private Sub Inet1_StateChan ged(ByVal State As Integer)
      > Const lCHUNKSIZE As Long = 1024
      > Dim vtData As Variant ' Data variable.
      >
      > Text1.Text = State 'For checking only
      >
      > Select Case State
      > Case icError ' 11
      > vtData = Inet1.ResponseC ode & ":" & _
      > Inet1.ResponseI nfo
      >
      > Case icResponseCompl eted ' 12
      > Dim strData As String: strData = ""
      > Dim bDone As Boolean: bDone = False
      >
      > ' Get first chunk.
      > vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
      > DoEvents
      >
      > Do While Not bDone
      >
      > strData = strData & vtData
      > ' Get next chunk.
      > vtData = Inet1.GetChunk( lCHUNKSIZE, icString)
      > DoEvents
      >
      > If Len(vtData) = 0 Then
      > bDone = True
      > End If
      > Loop
      >
      > Case icDisconnected
      > Debug.Print "* Disconnected"
      > Unload Me
      >
      > End Select
      > End Sub[/color]


      Comment

      Working...