📄 addfile.frm
字号:
VERSION 5.00
Begin VB.Form Dialog6
BorderStyle = 3 'Fixed Dialog
Caption = "添加文件"
ClientHeight = 4200
ClientLeft = 4695
ClientTop = 4095
ClientWidth = 6840
Icon = "AddFile.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "AddFile.frx":0E42
ScaleHeight = 4200
ScaleWidth = 6840
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
Height = 300
Left = 0
TabIndex = 5
Text = "Combo1"
Top = 3840
Width = 2535
End
Begin VB.CommandButton Command2
Caption = "取消(&E)"
Height = 375
Left = 5640
TabIndex = 4
Top = 840
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定(&Q)"
Height = 375
Left = 5640
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.DirListBox Dir1
Height = 3660
Left = 2640
TabIndex = 2
Top = 120
Width = 2775
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 2640
TabIndex = 1
Top = 3840
Width = 2775
End
Begin VB.FileListBox File1
Height = 3690
Left = 0
MultiSelect = 2 'Extended
TabIndex = 0
Top = 120
Width = 2535
End
End
Attribute VB_Name = "Dialog6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
Dim x As Integer
x = Drive1.Drive
Y = Dir1.Path
Open App.Path & "\temp\dir" For Output As #1 '有何用处,缺少为何无法写入
Print #1, ""
Close #1
Open App.Path & "\temp\dir" For Output As #1 '将打开的路径保存
Print #1, x
Print #1, Y
Close #1
For x = 0 To File1.ListCount - 1
If File1.Selected(x) = True Then
Dialog9.List1.AddItem Dir1.Path & "\" & File1.List(x)
End If
Next x
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo errorlabel
Dir1.Path = Drive1.Drive
Exit Sub
errorlabel: MsgBox "设备可能未准备好,请准备好再试.", vbExclamation, "提示"
End Sub
Private Sub File1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim x As Integer
x = 0
If Shift = 2 And KeyCode = vbKeyA Then
For x = 0 To File1.ListCount - 1
File1.Selected(x) = True
Next x
End If
End Sub
Private Sub File1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
File1.Pattern = "*.Mp3;*.MPEG;*.avi;*.wav;*.DAT;*.WM;*.Wma;*.midi;*.mid;*.mps;*.mp4;*.mpga;*.mp1;*.mp2;*.pls;*.xpl;*.AU"
With Combo1
.Text = "*.Mp3;*.MPEG;*.avi;*.wav;*.DAT;*.WM;*.Wma;*.midi;*.mps;*.mp4;*.mpga;*.mp1;*.mp2;*.pls;*.xpl;*.AU"
.AddItem "*.Mp3;*.MPEG;*.avi;*.wav;*.DAT;*.WM;*.Wma;*.midi;*.mps;*.mp4;*.mpga;*.mp1;*.mp2;*.pls;*.xpl;*.AU"
.AddItem "*.wav"
.AddItem "*.Dat"
.AddItem "*.Mpeg"
.AddItem "*.*"
End With
Open App.Path & "\temp\dir" For Input As #1 '将上次打开的路径读入
On Error Resume Next
Do While Not EOF(1)
Line Input #1, nextline
If nextline = "" Then
Close #1
Exit Sub '为空则退出
Else
Seek #1, 0
Line Input #1, nextline
Dir1.Path = nextline
nextline = ""
Seek #1, 1
Line Input #1, nextline
Drive1.Drive = nextline
Exit Do
End If
Loop
Close #1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -