VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MsComCtl.ocx"
Begin VB.Form frmMain
BorderStyle = 3 'Fixed Dialog
Caption = "Locate File"
ClientHeight = 3615
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6015
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3615
ScaleWidth = 6015
ShowInTaskbar = 0 'False
Begin MSComctlLib.ImageCombo ic
Height = 330
Left = 840
TabIndex = 4
Top = 120
Width = 3375
_ExtentX = 5953
_ExtentY = 582
_Version = 393216
ForeColor = -2147483640
BackColor = -2147483643
End
Begin MSComctlLib.ListView lv
Height = 2055
Left = 120
TabIndex = 3
Top = 480
Width = 5775
_ExtentX = 10186
_ExtentY = 3625
View = 2
Arrange = 2
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Object.Width = 2540
EndProperty
End
Begin VB.CommandButton CancelButton
Caption = "Cancel"
Height = 375
Left = 4680
TabIndex = 1
Top = 3120
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "OK"
Height = 375
Left = 4680
TabIndex = 0
Top = 2640
Width = 1215
End
Begin VB.Label Label1
Caption = "Look In:"
Height = 255
Left = 165
TabIndex = 2
Top = 165
Width = 675
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents mFTP As cFTP
Attribute mFTP.VB_VarHelpID = -1
Private strPath As String
Private strFilename As String
Private Sub FileSelected()
Dim x As Integer
On Error Resume Next
If lv.SelectedItem = ".." Then
For x = Len(strPath) To 1 Step -1
If Mid$(strPath, x, 1) = "/" Then _
Exit For
Next x
mFTP.SetFTPDirectory lv.SelectedItem
RefreshDirectoryListing
ElseIf Mid$(lv.SelectedItem, Len(lv.SelectedItem) - 3, 1) = "." Then
' File has been selected
ctlPath = Left$(strPath, Len(strPath) - 1)
ctlFilename = lv.SelectedItem
Unload Me
Else
' Directory selected
strPath = strPath & lv.SelectedItem & "/"
mFTP.SetFTPDirectory lv.SelectedItem
RefreshDirectoryListing
End If
End Sub
Private Sub RefreshDirectoryListing()
Dim Item As cDirItem
Dim lstX As ListItem
Dim sAttr As String
Screen.MousePointer = vbHourglass
mFTP.GetDirectoryListing "*.*"
ic.ComboItems.Clear
lv.ListItems.Clear
Set lstX = lv.ListItems.Add(, , "..")
For Each Item In mFTP.Directory
sAttr = ""
With Item
If .Directory Then
ic.ComboItems.Add , , Item.Filename
lv.ListItems.Add , , Item.Filename
End If
End With
Next
For Each Item In mFTP.Directory
sAttr = ""
With Item
If .Directory Then
Else
lv.ListItems.Add , , Item.Filename
End If
End With
Next
Screen.MousePointer = vbNormal
End Sub
Private Sub CancelButton_Click()
ctlCancelError = True
Unload Me
End Sub
Private Sub Form_Load()
Set mFTP = New cFTP
If mFTP.OpenConnection(ctlServer, ctlUser, ctlPassword) Then
Else
Unload Me
End If
RefreshDirectoryListing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set mFTP = Nothing
End Sub
Private Sub ic_Click()
mFTP.SetFTPDirectory ic.Text
RefreshDirectoryListing
End Sub
Private Sub lv_DblClick()
FileSelected
End Sub
Private Sub OKButton_Click()
FileSelected
End Sub