小弟用的API复制文件.隐藏了系统自带的进度条
想自己做出进度条来显示文件的复制进度.
但是没有头绪,哪位有方案的请告诉我:)

解决方案 »

  1.   

    以前收藏的,没用过: sub CopyFile(Src As String, Dst As String) As Single 
         Dim BTest!, FSize! 
         Dim F1%, F2% 
         Dim sArray() As Byte 
         Dim buff As Integer 
         
         Const BUFSIZE = 1024 
         
         buff = 1024 
         
         F1 = FreeFile 
         Open Src For Binary As F1 
         F2 = FreeFile 
         Open Dst For Binary As F2 
         
         FSize = LOF(F1) 
         BTest = FSize - LOF(F2) 
         ReDim sArray(BUFSIZE) As Byte 
         
         Do 
         If BTest < BUFSIZE Then 
         buff = BTest 
         ReDim sArray(buff) As Byte 
         End If 
         
         Get F1, , sArray 
         Put F2, , sArray 
         
         BTest = FSize - LOF(F2) 
         If BTest < 0 Then 
         ProgressBar.Value = 100 
         Else 
         ProgressBar.Value = (100 - Int(100 * BTest / FSize)) 
         End If 
         Loop Until BTest <= 0 
         
         Close F1 
         Close F2 
         CopyFile = FSize 
         
        End sub
      

  2.   

    或者直接利用微软提供的IProgressDialog接口实现
    参考:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iactivedesktop/iactivedesktop.asp
      

  3.   

    http://www.msjogren.net/dotnet/download.asp?progdlg.zip这是一个包含所需tlb文件的vb例子