Using Win32 functions in Visual FoxPro Image Gallery
URL Monikers
Code examples:
How to download a file from HTTP server using URL Monikers functions
The DetectAutoProxyUrl function identifies the auto-config script location
How to download a file from HTTP server using URL Monikers functions

User rating: 9.75/10 (4 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
click to open
Before you begin:
Check similar example based on WinInet functions (HTTP)

DECLARE INTEGER URLDownloadToFile IN urlmon.dll;
    INTEGER pCaller, STRING szURL,;
    STRING szFileName, INTEGER dwReserved,;
    INTEGER lpfnCB

LOCAL cRemoteFile, cLocalFile, nResult
cRemoteFile = ""
cLocalFile = "c:\temp\"

WAIT WINDOW NOWAIT "Downloading file..."
nResult = URLDownloadToFile(0, cRemoteFile, cLocalFile, 0,0)

IF nResult = 0
    ? "The file has been downloaded."
    ? "The URLDownloadToFile call failed with error code:", nResult

User rating: 9.75/10 (4 votes)
Rate this code sample:
  • ~
542 bytes  
Created: 2001-10-26 18:32:29  
Modified: 2016-10-03 22:20:03  
Visits in 7 days: 75  
Listed functions:
Printer friendly API declarations
My comment:
The simplicity and small size of this code does impress. Though there is no way - to my knowledge - to attach a progress bar to a download, since Visual FoxPro does not support callback functions.

The URLDownloadToFile sends HTTP GET and receives a response back from a server. Upon success the response contains a requested file.

See also: DeleteUrlCacheEntry
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
18 sec.Function: 'GetCurrentThread'
Function group: 'Process and Thread'
59 sec.Function: 'inet_ntoa'
Function group: 'Windows Sockets 2 (Winsock)'
1.32 min.Banners
1.6 min.
1.95 min.
Function group: 'Virtual Hard Disk (Win7)'
2.23 min.
Function group: 'Clipboard'
2.55 min.Function: 'FtpOpenFile'
2.83 min.Function: 'SetFilePointerEx'
Function group: 'File Management'
3.13 min.Function: 'SetSearchPathMode'
Function group: 'File Management'
3.43 min.Function: 'CreateProcess'
Function group: 'Process and Thread'
Advertise here!