Jump to content

Donwload with HttpSetProxy


Recommended Posts

Hello, to start i'm french guy ( i search a answer I can not find the solution on the french forum ) so excuse me for my english....

My problem is: I search a solution to include the HttpSetProxy function in my script who's next:

I'm sorry to disturb you.

GUICreate("Telechargement de:",  400, 200, 300, 200)

Global $Progress1 = GUICtrlCreateLabel("", 105, 120, 150, 20)
Global $Pourcent1 = GUICtrlCreateLabel("(100%)", 280, 65)
Global $progressbar_traitement = GUICtrlCreateProgress(50, 80, 250, 20)
Global $label_progressbar_traitement = GUICtrlCreateLabel("", 50, 65, 150, 20)
Global $LocalFile = "C:\IFilterPDF.rar"
Global $URL = "http://www.greenpdfpaper.com/setup/documalis/IFilterPDF.rar"
Global $Download = InetGet($URL, $LocalFile, 1, 1) ;Telecharge
Global $TotalSize = 0
;$stopped = 0
Global $stop = GUICtrlCreateButton("Cancel", 220, 120, 80, 20)





GUISetState()
GUIRegisterMsg(0x0111, "WM_COMMAND")   ;0x0111= Windows code for stop


Func HttpDownloadFile($URL,$LocalFile)
GUICtrlSetData($label_progressbar_traitement, "Telechargement de:en cours ...")
_MAJ_progressbar($progressbar_traitement, $Pourcent1, 0) ; Reset the progressbar
While Not InetGetInfo($Download, 2) ;As the download is not complete
Sleep(200)
$KbRecu = InetGetInfo($Download, 0) ;Gets the Kilo Byte received

If $KbRecu > 0 Then
If $TotalSize = 0 Then
$TotalSize = InetGetInfo($Download, 1) ;Get the file size
EndIf

$Pourcentage = Round ($KbRecu / $TotalSize * 100) ;calculating the percentage
GUICtrlSetData($Pourcent1, $Pourcentage) ;transferred the percentage value of the ProgressBar
_MAJ_progressbar($progressbar_traitement, $Pourcent1, $Pourcentage)
  EndIf


WEnd
EndFunc


Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
  #forceref $hWnd, $Msg, $lParam
 Switch BitAND($wParam, 0x0000FFFF)   ; look at where the message came from
    Case $stop            ; if $ stop button
        If BitShift($wParam, 16)=0 Then _Interruption()   ; and if it is clicking, then ...
 EndSwitch
  Return 'GUI_RUNDEFMSG'
EndFunc


Func _MAJ_progressbar($id_progressbar, $id_label_pourcentage, $valeur)
GUICtrlSetData($id_progressbar, $valeur)
GUICtrlSetData($id_label_pourcentage, "("&$valeur&"%)")
EndFunc



Func _Interruption()
    If MsgBox(36, "Confirmation", "Interrompre le téléchargement?") = 6 Then $run = 0
InetClose($Download)
 ;Msgbox(0,"", "")
    Exit
EndFunc

Thank you for those who take the time to read.

Quentin.

Link to comment
Share on other sites

I read the help file but i don't understand ! otherwise i don't write the Subject. I search just the operation of this function, if i'm put just a line or put a function.

I'm very sorry for the disturb but I need this information that's all.

My words are not bad but I started with this language. I just want to know where to put the HttpsetProxy and if we just let the line or if we made ​​a dedicated function. I just need it! I do not ask you to do me but that I needle. I'm sorry to bother you again for such a thing.

I'll manage, have a good day (or night ^^) :)

Quentin.

Edited by quentin44
Link to comment
Share on other sites

Quand j'ai dit ça dépend de ce que tu veux faire, c'est parce qu'il y a 3 options possibles avec la fonction HttpSetProxy par son paramètre qui est un drapeau.

Tu veux spécifier un proxy avec une adresse ou bien choisir le proxy qui est dans les options d'internet explorer?

When I said it depends on what you want to do, that's because there is 3 possible options with the function HttpSetProxy by its parameter which is a flag.

You want to specify a proxy with an address or to choose the proxy which is in the IE settings?

Br, FireFox.

Link to comment
Share on other sites

Je veut spécifier un proxy, mais du coup je laisse juste le HttpSetProxy(2, "www-cache.myisp.net:8080")

ou je doit développé plus en détails?

I want to specify a proxy, but suddenly I just let the HttpSetProxy(2, "www-cache.myisp.net:8080") or must I developed in more detail?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...