Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get an HTML page using INET

Posted on 1999-07-13
7
Medium Priority
?
316 Views
Last Modified: 2010-05-02
Trying to get an HTML page using the INET control, I don't receive the whole content.
I tried to test 'STATECHANGED' ( 8 and 12), stillexecuting, responseinfo.  Nothing seems to work.
We are using VB6 without any Service Pack.  The HTML page is generated by a CGI program.
Is it a known problem ?
Have I to test something else ?

Thanks for your help
Regards
Michel
0
Comment
Question by:MSCORY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Expert Comment

by:simonbennett
ID: 1524256
1) Install SP2 just to be sure...
2) What version of IE is installed?
3) Is the CGI code proven through another browser?
4) Does the behaviour still occur if you re .navigate to the url?
0
 
LVL 6

Expert Comment

by:simonbennett
ID: 1524257
1) Install SP2 just to be sure...
2) What version of IE is installed?
3) Is the CGI code proven through another browser?
4) Does the behaviour still occur if you re .navigate to the url?
0
 

Author Comment

by:MSCORY
ID: 1524258
SP2 ? why not SP3
IE 4, but I don't use IE in this context !
With any browser it works.
Yes and no, it depends on: unpredictable !
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 6

Expert Comment

by:simonbennett
ID: 1524259
Your IE installation can have a direct effect on the behaviour of the INET contorl (see misc Technet articles). I know very little about CGI im afraid. The only other thing i can suggest is installing IE 5 (and No, i don;t work for MS ;-))

Sorry thats all I can say...
0
 
LVL 14

Expert Comment

by:waty
ID: 1524260
0
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
ID: 1524261
Private Const ftpDIR As Integer = 0
Private Const ftpPUT As Integer = 1
Private Const ftpGET As Integer = 2
Private Const ftpDEL As Integer = 3
Private iLastFTP As Integer
Private Sub cmdConnect_Click()
    On Error GoTo ConnectError
    Inet1.URL = txtURL
    Inet1.UserName = txtUserName
    Inet1.Password = txtPassword
    Inet1.Protocol = icFTP
    iLastFTP = ftpDIR

    Inet1.Execute Inet1.URL, "DIR"
End Sub

Private Sub Inet1_StateChanged(ByVal _
    State As Integer)
    Select Case State
        Case icNone
         sbFTP.Panels("status").Text = ""
        Case icResolvingHost
         sbFTP.Panels("status").Text
           = "Resolving Host"
        Case icHostResolved
         sbFTP.Panels("status").Text _
           = "Host Resolved"
        Case icConnecting
         sbFTP.Panels("status").Text _
           = "Connecting..."
        Case icConnected
         sbFTP.Panels("status").Text _
           = "Connected!"
        Case icRequesting
         sbFTP.Panels("status").Text _
           = "Requesting..."
        Case icRequestSent
         sbFTP.Panels("status").Text _
           = "Request Sent"
        Case icReceivingResponse
         sbFTP.Panels("status").Text _
           = "Receiving Response..."
        Case icResponseReceived
         sbFTP.Panels("status").Text _
           = "Response Received!"
        Case icDisconnecting
         sbFTP.Panels("status").Text _
           = "Disconnecting..."

        Case icDisconnected
         sbFTP.Panels("status").Text _
           = "Disconnected"
        Case icError
         sbFTP.Panels("status").Text _
           = "Error! " & Trim(CStr( _
           Inet1.ResponseCode)) & _
           ": " & Inet1.ResponseInfo
        Case icResponseCompleted
         sbFTP.Panels("status").Text _
           = "Response Completed!"
            ReactToResponse iLastFTP
    End Select
End Sub

Public Function _
    ReactToResponse(ByVal _
    iLastCommand As Integer) As Long
    Select Case iLastCommand
        Case ftpDIR
            ShowRemoteFileList
        Case ftpPUT
            MsgBox "File Sent from " & CurDir()
        Case ftpGET
            MsgBox "File Received "& "in " & CurDir()
        Case ftpDEL
    End Select
End Function

Public Function ShowRemoteFileList() As Long
    Dim sFileList As String
    Dim sTemp As String
    Dim p As Integer
    sTemp = Inet1.GetChunk(1024)
    Do While Len(sTemp) > 0
        DoEvents
        sFileList = sFileList & sTemp
        sTemp = Inet1.GetChunk(1024)
    Loop
    lstRemoteFiles.Clear
    Do While sFileList > ""
        DoEvents
        p = InStr(sFileList, vbCrLf)
        If p > 0 Then
            lstRemoteFiles.AddItem
                Left(sFileList, p - 1)
            If Len(sFileList) > (p + 2) Then
                sFileList = Mid(sFileList, p + 2)
            Else
                sFileList = ""
            End If
        Else
            lstRemoteFiles.AddItem sFileList
            sFileList = ""
        End If
    Loop
End Function

Public Function GetFiles(sFileList As String) As Long
    Dim sFile As String
    Dim sTemp As String
    Dim p As Integer
    iLastFTP = ftpGET
    sTemp = sFileList
    Do While sTemp > ""
        DoEvents
        p = InStr(sTemp, "|")
        If p Then
            sFile = Left(sTemp, p - 1)
            sTemp = Mid(sTemp, p + 1)
        Else
            sFile = sTemp
            sTemp = ""
        End If
        Inet1.Execute Inet1.URL, "GET " & sFile & _
            " " & sFile
    'wait until this execution is done
    `before going to next file
        Do
            DoEvents
        Loop Until Not _
            Inet1.StillExecuting
    Loop
    iLastFTP = ftpDIR
    Inet1.Execute Inet1.URL, "DIR"
End Function
Public Function PutFiles(sFileList As String) As Long
    Dim sFile As String
    Dim sTemp As String
    Dim p As Integer
    iLastFTP = ftpPUT
    sTemp = sFileList
    Do While sTemp > ""
        DoEvents
        p = InStr(sTemp, "|")
        If p Then
            sFile = Left(sTemp, p - 1)
            sTemp = Mid(sTemp, p + 1)
        Else
            sFile = sTemp
            sTemp = ""
        End If
        Inet1.Execute Inet1.URL, "PUT" & sFile & _
            " " & sFile
    'wait until this execution is done
    `before going to next file
        Do
            DoEvents
        Loop Until Not Inet1.StillExecuting
    Loop
    iLastFTP = ftpDIR
    Inet1.Execute Inet1.URL, "DIR"
End Function

Private Sub dirLocal_Change()
    filLocal.Path = dirLocal.Path
End Sub

Private Sub drvLocal_Change()
    dirLocal.Path = drvLocal.Drive
End Sub

Private Sub filLocal_DragDrop(Source _
        As Control, X As Single, Y As Single)
    'receiving files from FTP site.
    Dim I As Integer
    Dim sFileList As String
    If TypeOf Source Is ListBox Then
        For i = 0 _
            To Source.ListCount - 1
            If Source.Selected(i) Then
                sFileList = _
                    sFileList & _
                    Source.List(i) & "|"
            End If
        Next
    End If
    If Len(sFileList) > 0 Then
        'strip off the last pipe
        sFileList = Left(sFileList, _
            Len(sFileList) - 1)
        GetFiles sFileList
    End If
End Sub

Private Sub _
    filLocal_MouseDown(Button As _
    Integer, Shift As Integer, X As _
    Single, Y As Single)
    filLocal.Drag vbBeginDrag
End Sub

Private Sub filLocal_MouseUp(Button _
    As Integer, Shift As Integer, _
    X As Single, Y As Single)
    filLocal.Drag vbEndDrag
End Sub

Private Sub _
    lstRemoteFiles_DragDrop(Source _
    As Control, X As Single, Y As Single)
    Dim I As Integer
    Dim sFileList As String
    If TypeOf Source Is FileListBox Then
        For i = 0 To Source.ListCount - 1
            If Source.Selected(i) Then
                sFileList = sFileList & _
                  Source.List(i) & "|"
            End If
        Next
    End If
    If Len(sFileList) > 0 Then
        'strip off the last pipe
        sFileList = Left(sFileList, _
            Len(sFileList) - 1)
        PutFiles sFileList
    End If
End Sub

Private Sub _
    lstRemoteFiles_KeyDown(KeyCode _
    As Integer, Shift As Integer)
    If KeyCode = vbKeyDelete Then
        Inet1.Execute Inet1.URL, "DEL " & _
            lstRemoteFiles.List( _
            lstRemoteFiles.ListIndex)
        Do
            DoEvents
        Loop While Inet1.StillExecuting
    End If
    iLastFTP = ftpDIR
    Inet1.Execute Inet1.URL, "DIR"
End Sub

Private Sub _
    lstRemoteFiles_MouseDown(Button _
    As Integer, Shift As Integer, )
    X As Single, Y As Single)
    lstRemoteFiles.Drag vbBeginDrag
End Sub

Private Sub lstRemoteFiles_MouseUp(Button As _
    Integer, Shift As Integer, _
    X As Single, Y As Single)
    lstRemoteFiles.Drag vbEndDrag
End Sub

0
 

Author Comment

by:MSCORY
ID: 1524262
Thanks for your help.  But I needed to use HTTP and not FTP.  Finally, I found that OPENURL doesn't work properly.  INET1.execute seems to be ok and it is quite similar.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question