تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تطبيق منقول - لعمل زر update now
#1
كاتب الموضوع : AhmedEssawy

منقول من freevbcode ...

URL: http://www.lanssoft.com/download/updatenow.zip


كود :
Option Explicit
'Using a proxy server
Private Sub chkUseProxy_Click()
If chkUseProxy.Value = 1 Then
txtProxy.Enabled = True
txtProxyPort.Enabled = True
txtUsername.Enabled = True
txtPassword.Enabled = True
Else
txtProxy.Enabled = False
txtProxyPort.Enabled = False
txtUsername.Enabled = False
txtPassword.Enabled = False
End If
End Sub
Private Sub cmdDownload_Click()
On Error Resume Next

'If there is a job running now, cancel it first!
If cmdDownload.Tag = "downloading" Then
DownloadFile1.CancelDownload

cmdDownload.Caption = "Download Now!"
cmdDownload.Tag = "ready"
Else
cmdDownload.Caption = "Cancel"
cmdDownload.Tag = "downloading"

'Clear the logs
List1.Clear

With DownloadFile1

'http://www.abc.com/ddd.exe => [url=http://www.abc.com/]www.abc.com[/url]
'www.abc.com/ddd.exe => [url=http://www.abc.com/]www.abc.com[/url]
'http://www.abc.com => [url=http://www.abc.com/]www.abc.com[/url]
'www.abc.com => [url=http://www.abc.com/]www.abc.com[/url]
.Server = txtServer

'http://www.abc.com/ddd.exe => /ddd.exe
'www.abc.com/ddd.exe => /ddd.exe
'/ddd.exe => /ddd.exe
.URL = txtServer

.Port = txtPort

.LocalFileName = txtLocalFile

.HTTPVersion = cboHTTPVer.ListIndex

.WhileFileExist = cboWhileFileExist.ListIndex

.UserName = txtUser.Text
.PassWord = txtPW.Text

'Use a proxy server
If chkUseProxy.Value = 1 Then
.ProxyServer = txtProxy
.ProxyPort = txtProxyPort
.ProxyPassword = txtPassword
.ProxyUserName = txtUsername
End If

Debug.Print String(40, "-")
Debug.Print .GetHttpHead

.StartDownload
End With
End If
End Sub
Private Sub cmdOK_Click()
If DownloadFile1.IsBusy Then DownloadFile1.CancelDownload
Unload Me
End Sub
'
Private Sub DownloadFile1_OnBeforeConnect()
List1.AddItem "Ready to connect to the host"
End Sub
Private Sub DownloadFile1_OnClose()
List1.AddItem "Connection was closed"
End Sub
Private Sub DownloadFile1_OnConnect()
List1.AddItem "Connect to the host successfully"
End Sub
Private Sub DownloadFile1_OnDataDownloaded(ByVal lDataLen As Long)
lblDownloadSize.Caption = DownloadFile1.DownloadedSize & "/" & DownloadFile1.DownloadFileSize & "Byte(s)"
End Sub
Private Sub DownloadFile1_OnError(ByVal Number As Integer, Description As String)
List1.AddItem "Error number: " & Number & " Error Desc.:" & Description

Debug.Print String(40, "-")
Debug.Print Number, Description
End Sub
Private Sub DownloadFile1_OnFinish()
'
'Maybe successfuly, or unsuccessfully!
'
List1.AddItem "Download then file completely"

cmdDownload.Caption = "Download Now!"
cmdDownload.Tag = "ready"

Debug.Print String(40, "-")
Debug.Print DownloadFile1.ReceiveHead
End Sub
Private Sub DownloadFile1_OnSendComplete()
List1.AddItem "Data were sent completely"
End Sub
Private Sub DownloadFile1_OnSendProgress(ByVal lBytesSent As Long, ByVal lBytesRemaining As Long)
List1.AddItem "Sending data to host, " & lBytesSent & "bytes are sent£¬" & lBytesRemaining & "byts are remaining"
End Sub
Private Sub DownloadFile1_OnStateChange(ByVal State As UpdateNow.StateConstants, ByVal StateDesc As String)
List1.AddItem "State change: " & State & ": " & StateDesc
End Sub
Private Sub Form_Load()
cboHTTPVer.ListIndex = 1

cboWhileFileExist.ListIndex = 1

'If you have a registration code,
'set the registration info. first.
DownloadFile1.RegName = "FreeTry"
DownloadFile1.RegID = "TrialVersion"

End Sub
'Ping the host
Private Sub cmdPing_Click()
PingHost1.HostName = txtServer
PingHost1.Ping
End Sub
Private Sub PingHost1_StateChange(ByVal State As Long, ByVal Description As String)
Debug.Print State, Description
lblPing = Description
End Sub
Private Sub PingHost1_PingFinish(ByVal StateString As String)
lblPing = StateString
End Sub
}}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  كود لعمل تحجيم تلقائي -AutoSize- لأداة مربع النص TextBox sooriaty03 7 1,619 29-05-16, 01:01 AM
آخر رد: CLARO
  كود بسيط لفحص الاتصال بالانترنت + تطبيق على الكود RaggiTech 0 532 17-10-12, 09:52 PM
آخر رد: RaggiTech
  مثال لجملة update باستخدام متغير يحمل عبارة sql RaggiTech 0 367 17-10-12, 07:20 PM
آخر رد: RaggiTech
  لعمل نسخة من Class دون استعمال الكلمة new RaggiTech 0 291 17-10-12, 06:14 PM
آخر رد: RaggiTech
  لعمل اختصار على سطح المكتب RaggiTech 0 330 17-10-12, 06:10 PM
آخر رد: RaggiTech
  لعمل اتصال نحو قاعدة بيانات MySQL RaggiTech 0 372 17-10-12, 06:09 PM
آخر رد: RaggiTech
  لعمل Serialization نحو XML RaggiTech 0 283 17-10-12, 06:09 PM
آخر رد: RaggiTech
  لعمل Ping لسيرفر RaggiTech 0 355 17-10-12, 06:09 PM
آخر رد: RaggiTech
  لعمل Back Up بطريقة سهلة RaggiTech 0 392 17-10-12, 06:07 PM
آخر رد: RaggiTech
  لعمل لون متدرج على الفورم RaggiTech 0 357 17-10-12, 05:31 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم