Posts: 1,091
Threads: 258
Joined: Jul 2022
Yesterday, 02:58 AM
(This post was last modified: Yesterday, 03:01 AM by Davider.)
When using the IntGetFile function with a link that has redirection, the file cannot be downloaded on some Windows 10 systems — the download progress window closes immediately.
Since the test computer does not have QM (Quick Macro) installed, I’m unable to retrieve any debugging information.
Is there any solution to this issue?
I noticed that the function has an `inetFlags` parameter, which enables redirection by default. In most cases, the download works correctly, but it fails on certain systems.
Thanks in advance for any suggestions or help.
Macro
Macro3
str url="https://dlink.host/1drv/aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBZ204d3BjSVhDanNnNHRuV2VyWDNxWk9BM0JBcUE.zip"
str tempFile=F"$Temp$\t.jpg"
IntGetFile url tempFile 16 0 1
Posts: 1,091
Threads: 258
Joined: Jul 2022
Is there a more stable, runtime-free, native method for downloading files that supports link redirection and works on Windows 7 and above?
Posts: 12,153
Threads: 143
Joined: Dec 2002
IntGetFile uses wininet API, it's is very old. It's better to use WinHttp API. Search this forum.
Posts: 1,091
Threads: 258
Joined: Jul 2022
Yesterday, 07:53 AM
(This post was last modified: Yesterday, 07:54 AM by Davider.)
Thanks for your help.
The code below works, but it doesn't show the download progress.
How can reuse the progress bar code below?
`SetProgressDialog(dlg); SetProgressCallback(fa fparam)`
Function
httpDownload_T
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest r._create
str url="https://dlink.host/1drv/aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBZ204d3BjSVhDanNnNHRuV2VyWDNxWk9BM0JBcUE.zip"
str tempFile=F"$desktop$\t.jpg"
r.Open("GET" url)
r.Send()
if(r.Status!=200) ret
ARRAY(byte) a=r.ResponseBody
str s.fromn(&a[0] a.len)
s.setfile(tempFile)
Posts: 12,153
Threads: 143
Joined: Dec 2002
Don't know. Google for "WinHttp progress".