Option Explicit
Dim WithEvents iFile As IClsFile
Dim CancelCopy As Boolean
Private Sub Command1_Click()
Dim Path1 As String
Dim Path2 As String
Path1 = "E:\Test.avi" '源文件
Path2 = "D:\Av.avi" '目标文件
CancelCopy = False
MsgBox iFile.FileCopyEx(Path1, Path2, True)
End Sub
Private Sub Command2_Click()
CancelCopy = True
End Sub
Private Sub Form_Load()
Set iFile = New IClsFile
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set iFile = Nothing
End Sub
Private Sub iFile_FileCopyExBegin()
MsgBox "iFile_FileCopyExBegin"
End Sub
Private Sub iFile_FileCopyExCancel()
MsgBox "iFile_FileCopyExCancel"
End Sub
Private Sub iFile_FileCopyExProgress(ByVal Progress As Long, Cancel As Boolean)
Label1.Caption = "已复制:" & Progress & "%"
Cancel = CancelCopy
End Sub
具体如何使用就看你的了,写类模块最主要的是可以定义事件,不过相对于模块速度慢点