Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Custom GDI+ class
Capturing keyboard activity of another application with the Raw Input API (VFP9)
How to print a bitmap file
How to display Windows On-Screen Keyboard
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
System Image List Viewer
Winsock: sending email messages (SMTP, port 25)
Creating the Save dialog box to specify the drive, directory, and name of a file to save
The window and its ancestors
Printing Image File, programmatically set print page orientation to landscape
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
How to convert a bitmap file to monochrome format (1 bpp)
Custom HttpRequest class (WinHTTP)
How to download a file from the FTP server using FtpGetFile
Using EnumPrinters function to enumerate locally installed printers
Custom FTP Class for Visual FoxPro application
Mapping and disconnecting network drives
Displaying icons in the system tray (VFP9)
How to activate Windows Calculator
Displaying the associated icons and descriptions for files and folders
Drawing Windows predefined bitmaps using the LoadBitmap functions
Sending email messages with Simple MAPI
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
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: 75  
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.242.233.11)
1.79 hrs.Function: 'CryptEnumProviders'
Function group: 'Cryptography Reference'
 Function: 'SQLDriverConnect'
2.86 hrs.Example: 'How to start the screen saver and how to find whether the screen saver is active'
2.87 hrs.Function: 'GetWindowPlacement'
 Function: 'waveOutOpen'
Function group: 'Windows Multimedia'
3.57 hrs.Function: 'IsWindowVisible'
6.17 hrs.Example: 'Using the DrawText function'
 Example: 'A class that encrypts and decrypts files using Cryptography API Functions'
6.61 hrs.Function: 'SQLAllocHandle'
Function group: 'ODBC API'
 Example: 'Using custom Simple MapiSendMail class'
Google
Advertise here!