Visual Basic - tiempo restante, tiempo estimado

Life is soft - evento anual de software empresarial
 
Vista:

tiempo restante, tiempo estimado

Publicado por wael (3 intervenciones) el 16/08/2008 05:54:02
nesecito que alguien me ayude en esto de visual basic cuando un archivo esta procesando quiero saber cuanto tiempo va tardar en lo pesa un archivo todo esta bueno los codigo solo falta tiempo restante o tiempo estimado
aqui le envio los codigo:

Function GO(WFIn As String, WFOut As String, WPass As String) As String

Dim StartByte As Long
Dim WByteFile As Long
Dim Result As Long
Dim DataIn As String * 1
Dim DataOut As String
Dim i

WFIn = Trim(WFIn)
WFOut = Trim(WFOut)
'chequeos necesarios
If WFIn = "" Or WFIn = " " Then GoSub Finalizar
If WFOut = "" Or WFOut = " " Then GoSub Finalizar

StartByte = 1
WByteFile = FileLen(WFIn)

On Error GoTo Finalizar
Open WFIn For Binary As #10 'archivo origen
Open WFOut For Binary As #15 'archivo destino

For i = StartByte To WByteFile Step 1
Get #10, i, DataIn 'Leemos los datos del archivo origen
Result = (i / WByteFile) * 100
LblTByte.Caption = "Tamaño De Archivo: " & i & " / " & WByteFile & " Bytes."
LblProgress.Caption = "Procesando: " & Result & " %"
ProgressBar1.value = Result
ProgressBar2.value = Result
DataOut = ""
Encriptar WPass, DataIn, DataOut 'encriptamos
Put #15, i, DataOut 'Escribimos en el archivo nuevo
DoEvents
Next i

Close #10
Close #15
GO = "Ok"
Exit Function

Finalizar:
OsenXPButton4.Enabled = True
OsenXPButton3.Enabled = True
OsenXPButton1.Enabled = True
OsenXPButton2.Enabled = True
MsgBox "Ocurrio Un Error!"
GO = "NotOk"
End Function
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:tiempo restante, tiempo estimado

Publicado por igor (633 intervenciones) el 16/08/2008 17:49:55
Yo lo dejaría así, para tiempos restante y estimado puedes hacer algo como si de 100 bytes ha tardado 0,1segundos y le quedan 9900 bytes pues:

Restante=9900*0,1/100=9,9 segundos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar