Verfasst: 01.01.2005 20:53
Das disconnect-erkennung läuft dann nicht, aber die eigentlich netzwerk-funktion sind ja PB-Interne. die API_ lassen sich auf einfache Datei-Routinen ummünzen.
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
IncludeFile "download.pbi"
Enumeration
#Window
#Progressbar
#Button_Submit
#Button_Abort
EndEnumeration
Procedure Window()
If OpenWindow(#Window, 0, 0, 300, 55, #PB_Window_TitleBar | #PB_Window_ScreenCentered, "GetIt")
If CreateGadgetList(WindowID())
ProgressBarGadget(#Progressbar, 5, 5, 290, 20, 0, 100)
ButtonGadget(#Button_Abort, 5, 30, 85, 20, "Abbrechen")
ButtonGadget(#Button_Submit, 210, 30, 85, 20, "Download")
EndIf
EndIf
EndProcedure
Window()
DoingDownload = #False
InitNetwork()
While WindowEvent() <> 0 : Wend
Repeat
If DoingDownload : Event = WindowEvent()
Else : Event = WaitWindowEvent() : EndIf
Select Event
Case #PB_Event_CloseWindow
If DoingDownload = #True : HTTP_CloseURL(Get2.HTTPGetId) : DoingDownload = #False : CloseWindow(#Window) : Break
Else : CloseWindow(#Window) : Break : EndIf
Case #PB_Event_Gadget
Select EventGadgetID()
Case #Button_Abort
If DoingDownload = #True : HTTP_CloseURL(Get2.HTTPGetId) : DoingDownload = #False : DisableGadget(#Button_Submit, 0)
Else : CloseWindow(#Window) : Break : EndIf
Case #Button_Submit
If HTTP_OpenUrl(Get2.HTTPGetId,"C:\test.zip","http://www.sedtech.com/isedquickpdf/downloads/4.35/iSQP0435DLL.zip","","",0,"",1024)
SetGadgetState(#Progressbar, 0) : DisableGadget(#Button_Submit, 1) : DoingDownload = #True
EndIf
EndSelect
EndSelect
If DoingDownload
If HTTP_ReceiveData(Get2)
SetGadgetState(#Progressbar, HTTP_GetProgress(Get2))
Else
DoDownload = #False
DisableGadget(#Button_Submit, 0)
HTTP_CloseURL(Get2)
EndIf
Delay(10)
EndIf
ForEver
Code: Alles auswählen
If DoingDownload
If HTTP_ReceiveData(Get2)
Debug "*"+Str(HTTP_GetFileReceived(Get2))
SetGadgetState(#Progressbar, HTTP_GetProgress(Get2))
Else
Debug "-"
DoingDownload = #False
DisableGadget(#Button_Submit, 0)
HTTP_CloseURL(Get2)
EndIf
Delay(10)
EndIf
die RAR downzuloaden und auf Update zu klicken?bluejoke hat geschrieben:die Fehlersuch-Routine wollt ich noch einbauen...
ich benutze zwar jaPBe (übrigens saugeil!) aber momentan nicht die aktuelle Version *zu-faul-bin*