Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Custom GDI+ class
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: sending email messages (SMTP, port 25)
Mapping and disconnecting network drives
How to display the Properties dialog box for a file (ShellExecuteEx)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Disk in drive A:
How to download a file from the FTP server using FtpGetFile
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to play AVI file on the _screen
Using Font and Text functions
Enumerating network resources
Using EnumPrinters function to enumerate locally installed printers
Vertical Label control
Creating irregularly shaped FoxPro form using transparency color key
Changing system colors
Custom HttpRequest class (WinHTTP)
Subclassing CommandButton control to create BackColor property
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Converting Unicode data from the Clipboard to a character string using a given code page
Using the DrawText function
Using Common Controls: the Header Control
How to download a file from HTTP server using URL Monikers functions

User rating: 10/10 (1 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: 10/10 (1 votes)
Rate this code sample:
  • ~
542 bytes  
Created: 2001-10-26 18:32:29  
Modified: 2005-12-21 15:51:54  
Visits in 7 days: 70  
Listed functions:
URLDownloadToFile
Printer friendly API declarations
My comment:
The simplicity and shortness of this code is exciting. Though there is no way -- to my knowledge -- to link a "progress-bar" procedure to this process, since Visual FoxPro does not support callback functions. I would wish to be wrong.

This function invokes GET HTTP Request and obtaines a response from the server. If the request is successful, the response contains the requested file.

Some times the DeleteUrlCacheEntry call is required to delete any possible cache entry prior to making the URLDownloadToFile call.
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-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.224.75.101)
6 sec.Function: 'Beep'
Function group: 'Error Handling'
41.83 min.Example: 'Removing FTP directory'
41.88 min.Function: 'GdipGetImageType'
3.01 hrs.Example: 'GDI+: sending image of FoxPro form to printer'
 Function: 'CharToOem'
Function group: 'String'
3.73 hrs.Example: 'Minimizing all running applications'
 Function: 'GlobalReAlloc'
4.08 hrs.Example: 'Current keyboard type'
 Function: 'NetUserGetGroups'
Function group: 'Network Management'
5.72 hrs.Function: 'GetCurrentProcessId'
Function group: 'Process and Thread'
Google
Advertise here!