📄 fcopy.frm
字号:
If Dir(outf + List2.Text + List1.Text, vbDirectory + vbNormal + vbArchive + vbHidden + vbReadOnly) = "" Then
FileCopy List3.Text, outf + List2.Text + List1.Text
Else
If Check2.Value = 1 Then
FileCopy List3.Text, outf + List2.Text + List1.Text
End If
End If
End If
DoEvents
Next
If size > 1048576 Then
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1048576) + "." + Mid(CStr(size / 1048576 - size \ 1048576), 3, 2) + " Mb"
Else
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1024) + "." + Mid(CStr(size / 1024 - size \ 1024), 3, 2) + " Kb"
End If
If List3.ListCount > 0 Then List3.ListIndex = 0
List3.Visible = True
fm.Visible = True
End If
End If
Else
MsgBox Chr(13) + "没有要复制的文件! ", vbExclamation
End If
Exit Sub
er:
MsgBox Chr(13) + "目标驱动器无写操作权! ", vbCritical
If size > 1048576 Then
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1048576) + "." + Mid(CStr(size / 1048576 - size \ 1048576), 3, 2) + " Mb"
Else
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1024) + "." + Mid(CStr(size / 1024 - size \ 1024), 3, 2) + " Kb"
End If
List3.Visible = True
fm.Visible = True
Exit Sub
err:
MsgBox Chr(13) + "无法复制:" + List3.Text + " " + Chr(13) + Chr(13) + "到:" + outf + List2.Text + List1.Text + Chr(13) + Chr(13) + "目标盘中没有足够的空间或存在同名的只读文件! ", vbCritical
If size > 1048576 Then
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1048576) + "." + Mid(CStr(size / 1048576 - size \ 1048576), 3, 2) + " Mb"
Else
Label3.Caption = "搜索结果列表:" + CStr(List3.ListCount) + " 个文件,占用磁盘空间:" + CStr(size \ 1024) + "." + Mid(CStr(size / 1024 - size \ 1024), 3, 2) + " Kb"
End If
List3.Visible = True
fm.Visible = True
End Sub
Private Sub Dir1_Change()
disk = Dir1.Path
If Right(disk, 1) <> "\" Then disk = disk + "\"
disk = UCase(disk)
fm1.Caption = "搜索: " + disk + Text1.Text
End Sub
Private Sub drive_Change()
On Error GoTo DriveErrs
Text1.SetFocus
Dir1.Path = drive.drive
fm1.Caption = "搜索: " + disk + Text1.Text
Exit Sub
DriveErrs:
Select Case err
Case 68
MsgBox Chr(13) + "无法访问驱动器 " + UCase(Left(drive.drive, 1)) + ": ", vbCritical
drive.drive = Dir1.Path
Exit Sub
Case Else
MsgBox Chr(13) + "应用程序错误。", vbCritical
End Select
End Sub
Private Sub Form_Activate()
Text1.Text = "*.*"
disk = Dir1.Path
If Right(disk, 1) <> "\" Then disk = disk + "\"
disk = UCase(disk)
mfile.Visible = False
str = ""
fm1.Caption = "搜索: " + disk + Text1.Text
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End
End Sub
Private Sub Form_Resize()
On Error Resume Next
List3.Width = Me.Width - List3.Left * 2.5
List3.Height = Me.Height - List3.Top - 600
End Sub
Private Sub List3_Click()
List1.ListIndex = List3.ListIndex
List2.ListIndex = List3.ListIndex
List4.ListIndex = List3.ListIndex
st = List3.ListIndex
End Sub
Private Sub List3_DblClick()
On Error GoTo err
' 获取被拖动的文件名的最后 3 个字母。
temp = LCase(Right$(List3.Text, 3))
dropfile = List3.Text
fp.Image1.Picture = LoadPicture("")
Select Case UCase$(Trim$(temp))
Case "MP3"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MP2"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MP1"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "WAV"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "DAT"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MID"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "AVI"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MPG"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MPA"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MPE"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "MPV"
play.mw1.Command = "open"
play.mw1.FileName = dropfile
play.mw1.Command = "play"
play.Caption = List1.Text
play.Width = Screen.Width \ 2
play.Height = Screen.Height \ 2
play.Show
Case "INI"
X = Shell("Notepad " + dropfile, 1)
Case "TXT"
X = Shell("Notepad " + dropfile, 1)
Case "BMP"
fp.Image1.Picture = LoadPicture(dropfile)
fp.Show
Case "GIF"
fp.Show
fp.Image1.Picture = LoadPicture(dropfile)
Case "JPG"
fp.Image1.Picture = LoadPicture(dropfile)
fp.Show
Case "EXE"
X = Shell(dropfile, 1)
Case "HLP"
X = Shell("WinHelp " + dropfile, 1)
Case Else
MsgBox Chr(13) + " 无法打开“" + UCase$(Trim$(temp)) + "”类型文件: " + Chr(13) + Chr(13) + " " + List3.Text + " ", vbCritical
End Select
Exit Sub
err:
MsgBox Chr(13) + " 无法打开文件: " + Chr(13) + Chr(13) + " " + List3.Text + " ", vbCritical
End Sub
Private Sub List3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
mopen.Caption = "打开:" + List1.Text
mdel.Caption = "移除:" + List1.Text
msave.Caption = "另存:" + List1.Text
mdelf.Caption = "删除:" + List1.Text
If List3.Text <> "" Then
mdel.Enabled = True
msave.Enabled = True
mdelf.Enabled = True
Else
mdel.Enabled = False
msave.Enabled = False
mdelf.Enabled = False
End If
' 获取被拖动的文件名的最后 3 个字母。
temp = LCase(Right$(List3.Text, 3))
dropfile = List3.Text
Select Case UCase$(Trim$(temp))
Case "MP3"
mopen.Enabled = True
Case "MP2"
mopen.Enabled = True
Case "MP1"
mopen.Enabled = True
Case "WAV"
mopen.Enabled = True
Case "DAT"
mopen.Enabled = True
Case "MID"
mopen.Enabled = True
Case "AVI"
mopen.Enabled = True
Case "MPG"
mopen.Enabled = True
Case "MPA"
mopen.Enabled = True
Case "MPE"
mopen.Enabled = True
Case "MPV"
mopen.Enabled = True
Case "INI"
mopen.Enabled = True
Case "TXT"
mopen.Enabled = True
Case "BMP"
mopen.Enabled = True
Case "GIF"
mopen.Enabled = True
Case "JPG"
mopen.Enabled = True
Case "EXE"
mopen.Enabled = True
Case "HLP"
mopen.Enabled = True
Case Else
mopen.Enabled = False
End Select
If List3.ListCount > 0 Then
mdelall.Enabled = True
mauto.Enabled = True
mseekf.Enabled = True
mdelaf.Enabled = True
Else
mdelall.Enabled = False
mauto.Enabled = False
mseekf.Enabled = False
mdelaf.Enabled = False
End If
If str = "" Then
mnext.Enabled = False
Else
mnext.Enabled = True
End If
PopupMenu mfile
End If
End Sub
Private Sub mauto_Click()
List3.Visible = False
For k = st To List3.ListCount - 1
List3.ListIndex = k
' 获取被拖动的文件名的最后 3 个字母。
temp = LCase(Right$(List3.Text, 3))
dropfile = List3.Text
Select Case UCase$(Trim$(temp))
Case "BMP"
fp.Image1.Picture = LoadPicture(dropfile)
GoTo bg
Case "GIF"
fp.Image1.Picture = LoadPicture(dropfile)
GoTo bg
Case "JPG"
fp.Image1.Picture = LoadPicture(dropfile)
GoTo bg
End Select
Next k
List3.Visible = True
MsgBox Chr(13) + "已经显示完搜索结果列表中的图片! ", vbExclamation
Exit Sub
bg:
fp.Image1.Width = 0
fp.Image1.Height = 0
fp.Image1.Picture = LoadPicture("")
fp.Image2.Picture = LoadPicture("")
Timer1.Interval = 1
Timer1.Enabled = True
Me.Hide
List3.Visible = True
fp.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -