ورود

View Full Version : سوال: پی بردن از میزار اطلاعات ارسال شده و باقی مانده در Internet Transfer



m2011kh
یک شنبه 12 آبان 1392, 15:24 عصر
سلام و خسته نباشید خدمت همه دوستان و اساتید محترم.
من با استفاده این کد فایل رو در یک سرور Ftp اپلود میکنم.میخواستم بدونم چطور باید بدونم که چه مقدار از دیتا ها ارسال شده.
Option Explicit

Private m_GettingDir As Boolean
Private Sub AddMessage(ByVal msg As String)
txtStat.Text = txtStat.Text & vbCrLf & msg
txtStat.SelStart = Len(txtStat.Text)
End Sub

Private Sub cmdUpload_Click()
Dim host_name As String

Enabled = False
MousePointer = vbHourglass
txtStat.Text = "Working"
txtStat.SelStart = Len(txtStat.Text)
DoEvents

' You must set the URL before the user name and
' password. Otherwise the control cannot verify
' the user name and password and you get the error:
'
' Unable to connect to remote host
host_name = "ftp.mmdkh.vvs.ir"
If LCase$(Left$(host_name, 6)) <> "ftp://" Then host_name = "ftp://" & host_name
INE.URL = host_name

INE.UserName = "*********"
INE.Password = "************"

' Do not include the host name here. That will make
' the control try to use its default user name and
' password and you'll get the error again.
INE.Execute , "Put " & _
"C:\IP.txt" & " " & "MMD.txt"

' m_GettingDir = True
' inetFTP.Execute , "Dir"
End Sub

Private Sub INE_StateChanged(ByVal State As Integer)
Select Case State
Case icError
AddMessage "Error: " & " " & INE.ResponseCode & vbCrLf & " " & INE.ResponseInfo
Case icNone
AddMessage "None"
Case icConnecting
AddMessage "Connecting"
Case icConnected
AddMessage "Connected"
Case icDisconnecting
AddMessage "Disconnecting"
Case icDisconnected
AddMessage "Disconnected"
Case icRequestSent
AddMessage "Request Sent"
Case icRequesting
AddMessage "Requesting"
Case icReceivingResponse
AddMessage "Receiving Response"
Case icRequestSent
AddMessage "Request Sent"
Case icResponseReceived
AddMessage "Response Received"
Case icResolvingHost
AddMessage "Resolving Host"
Case icHostResolved
AddMessage "Host Resolved"

Case icResponseCompleted
AddMessage INE.ResponseInfo

If m_GettingDir Then
Dim txt As String
Dim chunk As Variant

m_GettingDir = False

' Get the first chunk.
chunk = INE.GetChunk(1024, icString)
DoEvents
Prog.Min = (chunk)
Prog.Max = 0
Prog.Value = 0
Do While Len(chunk) > 0
Prog.Value = chunk
txt = txt & chunk
chunk = INE.GetChunk(1024, icString)
DoEvents
Loop

AddMessage "----------"
AddMessage txt
End If

Case Else
AddMessage "State = " & Format$(State)
End Select

Enabled = True
MousePointer = vbDefault
End Sub



البته هدفم زیاد مهم نیست امّا باید برای کاربر یک ProgressBar بزارم تا از میزان عمل انجام شده مطلع بشه.
موفق و سربلند باشید.

MMD

m2011kh
سه شنبه 28 آبان 1392, 14:28 عصر
دوستان پاسخی برای سوال بنده نداشتن؟؟؟