Click to See Complete Forum and Search --> : FTP code does not work in VB6


Konstantin
October 8th, 1999, 06:21 PM
I have problem with using MSDN Visual Studio 6.0.
Then I use sample codes for FTP application from VB6 Black Book
VB C++ 6.0 showing error for line with code
strDirString = Inet1.OpenURL("ftp://ftp.microsoft.com/")
Below is ful text of codes from "Sample" folder at MSDN Library Visual
Studio 6.0.
------------------------------------------------------------------------
Private Sub Command1_Click()
Dim strDirString, strFileName As String
Dim intStart, intEnd As Integer

strDirString = Inet1.OpenURL("ftp://ftp.microsoft.com/")

intStart = InStr(strDirString, """/")

While (intStart <> 0)
intEnd = InStr(intStart + 4, strDirString, """")
strFileName = Mid(strDirString, intStart + 2, intEnd - intStart
- 2)
If InStr(strFileName, "/") = 0 Then
List1.AddItem strFileName
End If
intStart = InStr(intEnd + 4, strDirString, """/")
Wend

End Sub

Private Sub Command2_Click()
List1_DblClick
End Sub

Private Sub List1_DblClick()
Dim bytData() As Byte

If InStr(List1.Text, ".txt") <> 0 Then
Text1.Text = Inet1.OpenURL("ftp://ftp.microsoft.com/" &
List1.Text)
Else
bytData() = Inet1.OpenURL("ftp://ftp.microsoft.com/" &
List1.Text, icByteArray)
Open "c:\vbbb\ftp\" & List1.Text For Binary Access Write As #1
Put #1, , bytData()
Close #1
MsgBox "Download complete"
End If
End Sub
------------------------------------------------------------------------
Would you please help me find the problem.
Thank you.

P.S.
Then I use code example with HELP in MSDN Library Visual Studio 6.0,
that codes for Visual Basic 5.0 program and I can't use or to read
them in VB C++ 6.0.(???)

An then in line
strDirString = Inet1.OpenURL("ftp://ftp.microsoft.com/")
use address URL ("http://www.microsoft.com/") I can see .html files