⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 用VB调用SSH控件
💻 FRM
📖 第 1 页 / 共 3 页
字号:
On Error Resume Next
    If ListView1.SelectedItem.Text <> "" Then
        TextDirectory.Text = Left(ListView1.SelectedItem.Text, 2) & "\"
        CmdBrowse_Click
    End If
End Sub

Private Sub Command1_Click()
If d = False Then
d = True
ListView1.Visible = False
Else
d = False
ListView1.Visible = True
End If


End Sub

Private Sub Command2_Click()
On Error Resume Next
  Dim Folder As Folder
    Dim file As file
    Dim drive As drive
    Dim SubFolder As Folder
    Dim i As Integer
    Dim Str As String
    
  '  If strDrive = "" Then Exit Sub
  '  If strFolder = "" Then Exit Sub
    '当前文件夹
  '  Set Folder = fso.GetFolder(strDrive & strFolder)
    '上级文件夹
  '  strFolder = Left(strFolder, InStrRev(strFolder, "\") - 1)
  
  '  cmbDrives.Text = strDrive & strFolder
  '  ListView3.ListItems.Clear
    

  '  If Not Folder.ParentFolder Is Nothing Then
        
        '添加子文件夹


  '      For Each SubFolder In Folder.ParentFolder.SubFolders
  '          ListView3.ListItems.Add , , SubFolder, 1, 1
  '          i = i + 1
  '      Next
        
        '添加文件


   '     For Each File In Folder.ParentFolder.Files
   '        ListView3.ListItems.Add , , File.Name, 5, 5
   '         i = i + 1
   '     Next
   '     i = ListView3.ListItems.Count
        
   ' Else


   '     For Each File In Folder.Files
   '          ListView3.ListItems.Add , , File.Name, 5, 5
   '         i = i + 1
   '     Next
   '     i = ListView3.ListItems.Count


   '     For Each SubFolder In Folder.SubFolders
            'lstFiles.AddItem SubFolder, i
   '         ListView3.ListItems.Add , , SubFolder, 1, 1
   '         i = i + 1
   '     Next
   ' End If
   
     i = 0
   
            Set Folder = fso.GetFolder(cmbDrives.Text)
            cmbDrives.Text = cmbDrives.Text
            ListView3.ListItems.Clear
            strFolder = strFolder & "\" & Folder.Name
            
            '添加子文件夹

            
            For Each SubFolder In Folder.SubFolders
                ListView3.ListItems.Add , , SubFolder, 1, 1
                i = i + 1
            Next
            
            '添加全部文件


            For Each file In Folder.Files
                ListView3.ListItems.Add , , file.Name, 6, 6
                i = i + 1
            Next
            i = ListView3.ListItems.Count
   
   
End Sub

Private Sub del_Click()
 On Error Resume Next
    If ListView2.SelectedItem.Text <> "" Then
        If Right(TextDirectory.Text, 1) <> "\" And Right(TextDirectory.Text, 1) <> "/" Then TextDirectory.Text = TextDirectory.Text & "\"
        Value& = MsgBox("你是要删除该文件吗?", vbYesNo + vbQuestion, "删除文件")
        If Value& = vbYes Then
            FrmPass.WinSockCtl.SendData "078" & TextDirectory.Text & ListView2.SelectedItem.Text
           ' Call CmdBrowse_Click
        FrmMain.List1.AddItem ("删除了远程" & TextDirectory.Text & ListView2.SelectedItem.Text & "          " & Date & "      " & Time & "")
        
        Set itwms = FrmMain.ListView4.ListItems.Add(, , "删除了远程" & TextDirectory.Text & ListView2.SelectedItem.Text)
     itwms.SubItems(1) = Date
     itwms.SubItems(2) = Time
     itwms.SubItems(3) = "文件删除"
        
        Else
            MsgBox "The file selected to be deleted has not been removed.", vbInformation, "Deleting files"
        End If
    End If
    Timer3.Enabled = True
   
End Sub

Private Sub delflie_Click()
On Error Resume Next

Value& = MsgBox("你是要删除该文件吗?", vbYesNo + vbQuestion, "删除文件")
        If Value& = vbYes Then
Kill Text1.Text
Set itwms = FrmMain.ListView4.ListItems.Add(, , "删除了本地" & Text1.Text)
     itwms.SubItems(1) = Date
     itwms.SubItems(2) = Time
     itwms.SubItems(3) = "文件删除"
End If
Command2_Click
End Sub

Private Sub dowdun_Click()
Client.Show
Me.Enabled = False
End Sub

Private Sub Exit_Click()

FrmPass.Winsock1.Close
FrmPass.WinSockCtl.Close
End
End Sub

'Private Sub Combo1_Change()
'ExplorerList1.TreeDatas
'End Sub

Private Sub Form_Load()


CobView.AddItem ("大图标")
CobView.AddItem ("自由排列")
CobView.AddItem ("列表")
CobView.AddItem ("小图标")
CobView.ListIndex = 2
CobView2.AddItem ("大图标")
CobView2.AddItem ("自由排列")
CobView2.AddItem ("列表")
CobView2.AddItem ("小图标")
CobView2.ListIndex = 2
 Dim drive As drive
    Dim i As Integer
    
    
    
    i = 0
    '添加驱动器

  ListView3.ColumnHeaders.Add , , "文件夹路径", 2500, , 2
    For Each drive In fso.Drives
        cmbDrives.AddItem drive.Path, i
        i = i + 1
    Next
 cmbDrives.ListIndex = 1
  '初始化远程文件目录
  FrmMain.ListView2.ColumnHeaders.Add , , "文件名", 2500
    FrmMain.ListView2.ColumnHeaders.Add , , "类型", 2500
    FrmMain.ListView2.ColumnHeaders.Add , , "大小", 2500
     FrmMain.ListView1.ColumnHeaders.Add , , "文件夹路径", 2500, , 2
     FrmMain.ListView4.ColumnHeaders.Add , , "事件", 5000
    FrmMain.ListView4.ColumnHeaders.Add , , "日期", 3000
    FrmMain.ListView4.ColumnHeaders.Add , , "时间", 3000
    FrmMain.ListView4.ColumnHeaders.Add , , "类型", 3000
 ListView2.Enabled = False
 ListView1.BackColor = &H80000000
 ListView2.BackColor = &H80000000
 'ListView2.BackColor = &H80000009 '白色

  d = False
End Sub

' Clean up...

Private Sub Form_Unload(Cancel As Integer)
 ' On Error Resume Next
 '
  'FrmPass.Winsock1.Close
  'FrmPass.WinSockCtl.Close
End Sub

Private Sub ListView1_Click()
On Error Resume Next
 If ListView1.SelectedItem.Text <> "" Then
TextDirectory.Text = ListView1.SelectedItem.Text
FrmPass.WinSockCtl.SendData "119" & TextDirectory.Text
End If
End Sub

Private Sub ListView1_DblClick()
On Error Resume Next
    If ListView1.SelectedItem.Text <> "" Then
        TextDirectory.Text = ListView1.SelectedItem.Text & "\"
        ListView1.SelectedItem.SmallIcon = ImageList.ListImages.Item(2).Picture
        ListView1.refresh
        Combo2.Text = TextDirectory.Text
        CmdBrowse_Click
    End If
End Sub

Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim litem As ListItem
If Button = 2 Then
    Set litem = ListView1.SelectedItem
    If ListView1.HitTest(X, Y) Is litem Then
        If litem Is Nothing Then Exit Sub
        PopupMenu nf
        Exit Sub
    End If
End If
End Sub

Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
 If Data.GetFormat(vbCFFiles) = True Then
'If Data.GetFormat(vbCFFiles) Then
  Dim Str, str1 As String
  Str = LCase(Mid(Data.Files(1), Len(Data.Files(1)) - 2, 3))
  str1 = Data.Files(1)
 MsgBox "" & str1
 FrmMain.Text1.Text = str1
 Setver.Show
  End If
End Sub

Private Sub ListView2_Click()
On Error Resume Next
    If ListView2.SelectedItem.Text <> "" Then
        If Right(TextDirectory.Text, 1) <> "\" And Right(TextDirectory.Text, 1) <> "/" Then TextDirectory.Text = TextDirectory.Text & "\"
        FrmPass.WinSockCtl.SendData "120" & TextDirectory.Text & ListView2.SelectedItem.Text
        'Text1.Text = TextDirectory.Text & ListFiles.SelectedItem.Text
    End If
End Sub

Private Sub ListView2_DblClick()
On Error Resume Next
    If ListView2.SelectedItem.Text <> "" Then
        If Right(TextDirectory.Text, 1) <> "\" And Right(TextDirectory.Text, 1) <> "/" Then TextDirectory.Text = TextDirectory.Text & "\"
        FrmPass.WinSockCtl.SendData "083" & TextDirectory.Text & ListView2.SelectedItem.Text
    End If
End Sub

Private Sub ListView2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim litem As ListItem
If Button = 2 Then
    Set litem = ListView2.SelectedItem
    If ListView2.HitTest(X, Y) Is litem Then
        If litem Is Nothing Then Exit Sub
        PopupMenu meutu
        Exit Sub
    End If
End If
End Sub

Private Sub ListView2_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Data.GetFormat(vbCFFiles) Then
  Dim Str, str1 As String
  Str = LCase(Mid(Data.Files(1), Len(Data.Files(1)) - 2, 3))
  str1 = Data.Files(1)
 MsgBox "" & str1
 FrmMain.Text1.Text = str1
 Setver.Show
  End If
End Sub

Private Sub ListView3_Click()
Dim Folder As Folder
    Dim SubFolder As Folder
    Dim file As file
    On Error Resume Next
If InStr(ListView3.SelectedItem.Text, ":\") Then
Exit Sub
Else
Text1.Text = cmbDrives.Text & "\" & ListView3.SelectedItem.Text
Set file = fso.GetFile(Text1.Text)

Txt.Text = file.Size
End If
End Sub

Private Sub ListView3_DblClick()

Dim Folder As Folder
    Dim SubFolder As Folder
    Dim file As file
    Dim i As Integer
    i = 0
On Error Resume Next

    'If Not ListView3.ListItems.Count > 1 Then
        
        If InStr(ListView3.SelectedItem.Text, ":\") Then
            Set Folder = fso.GetFolder(ListView3.SelectedItem.Text)
            cmbDrives.Text = ListView3.SelectedItem.Text
            ListView3.ListItems.Clear
            strFolder = strFolder & "\" & Folder.Name
            
            '添加子文件夹

            
            For Each SubFolder In Folder.SubFolders
                ListView3.ListItems.Add , , SubFolder, 1, 1
                i = i + 1
            Next
            
            '添加全部文件


            For Each file In Folder.Files
                ListView3.ListItems.Add , , file.Name, 6, 6
                i = i + 1
            Next
            i = ListView3.ListItems.Count
        End If
   ' End If

End Sub



Private Sub ListView3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim litem As ListItem
If Button = 2 Then
    Set litem = ListView3.SelectedItem
    If ListView3.HitTest(X, Y) Is litem Then
        If litem Is Nothing Then Exit Sub
        PopupMenu meul
        Exit Sub
    End If
End If
End Sub

Private Sub ListView3_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
'
If Data.GetFormat(vbCFFiles) Then
  Dim Str, str1 As String
  Str = LCase(Mid(Data.Files(1), Len(Data.Files(1)) - 2, 3))
  str1 = Data.Files(1)
 
 'FrmMain.ListView3.ListItems.Add , , str1
 FileCopy Str, cmbDrives.Text
End If

End Sub

'Private Sub mnuFileAbout_Click()
'  Call ShellAbout(hWnd, "About the VB Explorer demo# ....adapted from EnumDeskVB", _
'                                    "Copyright 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -