當前位置:編程學習大全網 - 源碼下載 - 更新源代碼

更新源代碼

私有函數GetKey(ByVal str As String)As String Dim no offset As Long no offset = InStr(str," = ")If no offset & gt;0然後GetKey = Trim(Mid(str,1,no ffset-1))Exit Function End If GetKey = vbNullString End Function Private Function GetVal(ByVal str As String)As String Dim no ffset As Long no ffset = InStr(str," = ")If no ffset & gt;0然後GetVal = Trim(Mid(str,no ffset+1))Else GetVal = vbNullString End If End Function Private Function GetHttpFileName(ByVal str As String)As String Dim no ffset As Long no ffset = instr rev(str,"/")Dim strTemp As String If no ffset & gt;0那麽strTemp = Trim(Mid(str,no ffset+1))End If GetHttpFileName = strTemp End Function Private Sub OnLoadConfigFaild()label 1。Caption = "無法獲取更新列表" End sub private sub loadfile(byval strfile as string)mstatus = task loadfile mfile = gethttp filename(strfile)。如果Len(mFile) = 0,則調用LoadFileFaild,如果Http。打開“GET”,strFile,True http . send label 1 . caption = "開始讀取文件" end subprivate Download file failed()label 1 . caption = " Download file failed " end subprivate Download file end()。出錯時GoTo lblErr:Dim byt data()As Byte byt data = Http。ResponseBody打開文件& amp. update . exe " for binary as # 1 put # 1,1,by tdata close label 1 . caption = " Restarting program " on error resume next shell " loader . exe " &;mFile & amp“,”& ampmFile & amp. update . exe " End exit sub LBLERR:label 1。caption = "下載文件失敗" End sub private sub更新百分比(byval n as long)如果mstatus =任務加載文件,則標簽為1。caption = "已下載" &;n & amp" % draw perent n End If End Sub Private Sub Http _ OnResponseStart(ByVal Status為Long,ByVal ContentType為String)nTotalSize = 0 nCurrSize = 0 On Error Resume Next nTotalSize = Http。如果狀態為& lt& gt200然後Http。對於i = 0到Picture1,中止LoadFileFaild End If End Sub Private Sub draw perent(ByVal n為Long)。ScaleWidth * n / 100圖片1。行(I,0)-(i,Picture1。ScaleHeight)、RGB(0 & amp;HFF & amp;H66)下壹個末端接頭
  • 上一篇:求用c語言編寫的播放背景音樂的代碼
  • 下一篇:誰有冒險島的所有怪物代碼!最好是所有。。。有的話順便職業與技能代碼都發壹下!
  • copyright 2024編程學習大全網