Using Win32 functions in Visual FoxPro Image Gallery
URL Monikers
..msdn
CreateURLMonikerEx
FindMediaType
IsValidURL
ObtainUserAgentString
URLDownloadToCacheFile
URLDownloadToFile
UrlMkGetSessionOption
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
Versions:
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 = "http://www.news2news.com/vfp/downloads/w32data.zip"
cLocalFile = "c:\temp\w32data.zip"

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

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



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: 116  
Listed functions:
URLDownloadToFile
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  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.198.246.116)
24 sec.Function: 'CeWriteFile'
Function group: 'Remote Application Programming (RAPI)'
Google
Advertise here!