WinHttp progress?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

WinHttp progress?

06 Oct 2015, 11:01

How to display download/upload progress using WinHTTP.WinHTTPrequest.5.1?

I've tried below two methods, both not working:
  • Code: Select all

    x := ComObjCreate("WinHTTP.WinHTTPrequest.5.1")
    ComObjConnect(x, "http_")
  • Code: Select all

    x := ComObjCreate("WinHTTP.WinHTTPrequest.5.1")
    x.OnResponseFinished := Func("Finished")
The WinHttpRequest.ahk by infogulch is very close to the answer:

Code: Select all

#Persistent
#Include, WinHttpRequest.ahk ; https://github.com/infogulch/WinHttpRequest
url := "http://ahkscript.org/boards/"
x := new WinHttpRequest({ OnResponseFinished: Func("Finished"), OnResponseDataAvailable: Func("Downloading") })
x.Open("GET", url, true)
x.Send()
Return

Downloading(id) {
	static n := 0
	; How to display the progress?
	ToolTip, % ++n
}

Finished(id) {
	msgbox Finished!
}
BTW, I know the HTTPrequest.ahk (by VxE) already had this feature, but I want to know how to do this in WinHTTP.

@lexikos: It would be nice if ComObjConnect support "WinHTTP.WinHTTPrequest.5.1".
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: WinHttp progress?

07 Oct 2015, 00:22

ComObjConnect only supports event source interfaces derived from IDispatch, for reasons I explained here.

IWinHttpRequestEvents::OnResponseDataAvailable accepts one parameter which is SAFEARRAY(unsigned char) *Data, but I haven't had any success accessing it with this script. MSDN also says "This is a VARIANT of type VT_ARRAY | VT_UI1", but it is not a VARIANT either afaict.

Also, the script does not work at all with AutoHotkey 64-bit on my system - none of the callbacks are called.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: WinHttp progress?

07 Oct 2015, 12:18

:cry: Thanks anyway.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, gsxr1300, inseption86, jaka1, mebelantikjaya, mikeyww and 298 guests