自定义文件复制进度条(请教)

shortppsy 2004-09-12 04:10:32
小弟用的API复制文件.隐藏了系统自带的进度条
想自己做出进度条来显示文件的复制进度.
但是没有头绪,哪位有方案的请告诉我:)
...全文
196 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
rainstormmaster 2004-09-12
  • 打赏
  • 举报
回复
http://www.msjogren.net/dotnet/download.asp?progdlg.zip

这是一个包含所需tlb文件的vb例子
rainstormmaster 2004-09-12
  • 打赏
  • 举报
回复
或者直接利用微软提供的IProgressDialog接口实现
参考:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iactivedesktop/iactivedesktop.asp
shortppsy 2004-09-12
  • 打赏
  • 举报
回复
那样只能遍历了,可惜VB的速度
试试看吧
rainstormmaster 2004-09-12
  • 打赏
  • 举报
回复
//我移植了,不过只能复制单个文件时能显示进度条

能显示一个就能显示多个,可以考虑用循环实现
a_cer 2004-09-12
  • 打赏
  • 举报
回复
有些懒了!!
shortppsy 2004-09-12
  • 打赏
  • 举报
回复
我移植了,不过只能复制单个文件时能显示进度条
而无法复制一个目录下所有的文件
那么会出错
请继续帮帮忙:)
northwolves 2004-09-12
  • 打赏
  • 举报
回复
以前收藏的,没用过:

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

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧