我梦想有几个文件下载错误,找个人发给个人的律师函我。...

在我以为都已经拥有了一切的时候,就在我寻觅出我余生的时候我以为我回到了追逐人生梦想的轨道上你让我拜倒在错误之下而后我发现我想念的不过是你的甜美和优雅我需要你每一个时刻我需要你每一天我需要你在那些美好的时刻我需要你当我泪流满面转身离开的时候
喜欢就猛击分享!
个性网内容精选:小弟我想作一个大文件拷贝的进度条,是用ProgressBar来作的,有几个小问题想问一下 - VB Dotnet当前位置:& &&&小弟我想作一个大文件拷贝的进度条,是用ProgressBa小弟我想作一个大文件拷贝的进度条,是用ProgressBar来作的,有几个小问题想问一下&&网友分享于:&&浏览:15次我想作一个大文件拷贝的进度条,是用ProgressBar来作的,有几个问题想问一下用线程和计时器来定时的查看当前目的路径的文件已经复制了多少,然后和源文件比较得出百分比,然后再来控制进度条的进度,可是现在有个问题,我是用System.IO.FileInfo.Length来得到目的文件的大小,可是发现不算是在复制的什么阶段,文件大小就是全部文件的大小,我想知道用什么方面可以得到当前正在复制的目的文件的真实大小,目的文件的大小应该是越来越大,真到和源文件一样大才对啊------解决方案--------------------
VB.NET code
Public Class Form1
& Public Const PROGRESS_CONTINUE As Integer = 0
& Public Const PROGRESS_CANCEL As Integer = 1
& Public Const PROGRESS_STOP As Integer = 2
& Public Const PROGRESS_QUIET As Integer = 3
& 'CopyFileEx callback routine state change values
& Public Const CALLBACK_CHUNK_FINISHED As Integer = &H0S
& Public Const CALLBACK_STREAM_SWITCH As Integer = &H1S
& 'CopyFileEx option flags
& Public Const COPY_FILE_FAIL_IF_EXISTS As Integer = &H1S
& Public Const COPY_FILE_RESTARTABLE As Integer = &H2S
& Public Const COPY_FILE_OPEN_SOURCE_FOR_WRITE As Integer = &H4S
& Public Declare Auto Function CopyFileEx Lib &kernel32& (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As CopyProgressEvent, ByVal lpData As Long, ByVal ByValpbCancel As Boolean, ByVal dwCopyFlags As Integer) As Integer
& Public Delegate Function CopyProgressEvent(ByVal TotalFileSize As Long, ByVal TotalBytesTransferred As Long, ByVal StreamSize As Long, ByVal StreamBytesTransferred As Long, ByVal dwStreamNumber As Integer, ByVal dwCallbackReason As Integer, ByVal hSourceFile As Integer, ByVal hDestinationFile As Integer, ByRef lpData As Integer) As Integer
& Public Function CopyProgress(ByVal TotalFileSize As Long, ByVal TotalBytesTransferred As Long, ByVal StreamSize As Long, ByVal StreamBytesTransferred As Long, ByVal dwStreamNumber As Integer, ByVal dwCallbackReason As Integer, ByVal hSourceFile As Integer, ByVal hDestinationFile As Integer, ByRef lpData As Integer) As Integer
& & Select Case dwCallbackReason
& & & Case CALLBACK_STREAM_SWITCH
& & & & Me.ProgressBar1.Value = 0
& & & & Me.ProgressBar1.Minimum = 0
& & & & Me.ProgressBar1.Maximum = (TotalFileSize)
& & & & CopyProgress = PROGRESS_CONTINUE
& & & Case CALLBACK_CHUNK_FINISHED
& & & & '// 显示进度
& & & & Try
& & & & & Me.ProgressBar1.Value = (TotalBytesTransferred)
& & & & Catch ex As Exception
& & & & & MessageBox.Show(ex.Message)
& & & & End Try
& & & & System.Windows.Forms.Application.DoEvents()
& & & & CopyProgress = PROGRESS_CONTINUE
& & End Select
& & CopyProgress = PROGRESS_CONTINUE
& End Function
& Public Function MyCopyFile(ByVal strFrom As String, ByVal strTo As String) As Boolean
& & Dim lngReturn As Long
& & lngReturn = CopyFileEx(strFrom, strTo, AddressOf CopyProgress, 0, False, COPY_FILE_RESTARTABLE)
& & If lngReturn = 0 Then
& & & MyCopyFile = False
& & & MyCopyFile = True
& & End If
& End Function
& Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
& & MyCopyFile(&c:\1.exe&, &d:\1.exe&)
& & MessageBox.Show(&拷贝完毕&)
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有

参考资料

 

随机推荐