urldownloadtofile / httprequest not working on win 7 pc

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
labrint
Posts: 379
Joined: 14 Jun 2017, 05:06
Location: Malta

urldownloadtofile / httprequest not working on win 7 pc

Post by labrint » 15 Apr 2021, 05:03

I have a win 7 pc where Urldownloadtofile is not working (error 1).

tried the following

Code: Select all

_download(u,s="") {
	wr:=comobjcreate("WinHttp.WinHttpRequest.5.1")
	wr.open("GET",u)
	wr.send()
	wr.WaitForResponse(5)
	if(wr.responsetext="failed"||wr.status!=200)
		return false
	if !s
		return wr.responsetext
	if(comobjtype(wr.ResponseStream)!=0xd)
		return false
	p:=comobjquery(wr.responsestream,"{0000000c-0000-0000-C000-000000000046}")
	f:=fileopen(s,"w")

	loop{	
			varsetcapacity(b,8192)
			r:=dllcall(numget(numget(p+0)+3*a_ptrsize),"ptr",p,"ptr",&b,"uint",8192, "ptr*",c)
			f.rawwrite(&b,c)
		}until (c=0)

	objrelease(p)
	f.close()
	return true
	}
Both work on other pcs, but this PC does not download!

Return to “Ask for Help (v1)”