vb实时判断文件已上传大小
例如:甲通过FTP的方式给乙传送一个1G大小的文件,乙通过软件每隔1秒检测一次文件已上传的大小,如何用vb实现?这样做的目的是:通过软件检测文件是否上传完毕,如果上传完成,则提示乙处理文件,如果未上传完成,则等待继续上传。 http://baike.baidu.com/view/1290372.htmGetFileSize API 不懂,每卡明明百
危险!文件大小到1GB不一定文件内容填写完1GB。
'Example Name:Get File Size
' Example by AKriLium-Death (bumpybl2@hotmail.com)
' Visit his site at http://rift.zeloop.com
'This project needs
' -a Command Button (Command1)
' -a CommonDialog (CommonDialog1)
' -a Label (Label1)
Private Const OF_READ = &H0&
Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Dim lpFSHigh As Long
Public Sub GetInfoF(FilePath As String)
Dim Pointer As Long, sizeofthefile As Long
Pointer = lOpen(FilePath, OF_READ)
'size of the file
sizeofthefile = GetFileSize(Pointer, lpFSHigh)
Label1.Caption = sizeofthefile & " bytes"
lclose Pointer
End Sub
Private Sub command1_Click()
CommonDialog1.ShowOpen
GetInfoF CommonDialog1.filename
End Sub
Private Sub Form_Load()
With CommonDialog1
.DialogTitle = "Select a file"
.Filter = "All the files|*.*"
End With
Command1.Caption = "Select a file"
End Sub
那要怎么做?
补充:VB , 基础类