Author Topic: Downloading TEXT file from internet  (Read 6670 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Downloading TEXT file from internet
« Reply #15 on: March 22, 2020, 02:08:49 pm »
You're very welcome, Terry.  Now that I'm out of work (most musicians here currently are due to the virus) I'll probably be participating more in the coding forums.  There sure is a lot of good programs people are posting here.  I'm enjoying just reading the forum.

- Dav

Offline IronMan

  • Newbie
  • Posts: 38
    • View Profile
Re: Downloading TEXT file from internet
« Reply #16 on: March 22, 2020, 05:28:14 pm »
Here's another method without using SHELL.  Just thought I'd throw it into the mix!  Works for me in Windows 7.  Download from https sites. Uses a built-in Windows Library function.   

- Dav

This works perfect when running in QB64. However, when I use it with the InFORM add on for QB64, it does some crazy things and locks up my computer. It may just be my computer.

Thanks for the code snippet.

- Kent

Code: QB64: [Select]
  1.     FUNCTION URLDownloadToFileA% (BYVAL pCaller AS LONG, szURL AS STRING, szFileName AS STRING, BYVAL dwReserved AS LONG, BYVAL lpfnCB AS LONG)
  2.  
  3. url$ = "https://tgftp.nws.noaa.gov/data/forecasts/zone/ms/msz024.txt"
  4. urlfile$ = "forecast.txt"
  5.  
  6. a% = URLDownloadToFileA%(0, url$, urlfile$, 0, 0)
  7.  
  8. SLEEP 5   'pause to allow the download to complete
  9.  
  10. IF a% = 0 THEN
  11.     PRINT "Downloaded!"
  12.     PRINT "NOT Downloaded!"
  13.  

Offline EricE

  • Forum Regular
  • Posts: 114
    • View Profile
Re: Downloading TEXT file from internet
« Reply #17 on: March 22, 2020, 06:15:02 pm »
Question: Is urlmon part of Microsoft's Internet Explorer, or of the Win32 API?

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Downloading TEXT file from internet
« Reply #18 on: March 22, 2020, 06:24:47 pm »
Sorry that is happening, Ironman.  Not sure why, using it hasn't locked up my pc before (I'm still on Win7 btw). 

EricE, urlmon.dll is an Internet Explorer library included with Windows.

- Dav


Offline EricE

  • Forum Regular
  • Posts: 114
    • View Profile
Re: Downloading TEXT file from internet
« Reply #19 on: March 22, 2020, 06:43:49 pm »
Thank you Dav.

Here is the Microsoft web page for the URLDownloadToFile function.

URLDownloadToFile function
https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775123(v%3Dvs.85)

Here is a web page containing much information about the urlmon dll.

Windows 7 DLL File Information - urlmon.dll
https://www.win7dll.info/urlmon_dll.html

FellippeHeitor

  • Guest
Re: Downloading TEXT file from internet
« Reply #20 on: March 22, 2020, 07:15:07 pm »
Can't use SLEEP with InForm.