Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Moving shortcut to a specified position on the Windows Desktop
Obtaining provider name for a specific type of network
Retrieving file information for the VFP executable running
System and Local Time values
Winsock: creating a socket that is bound to a specific service provider
A class that encrypts and decrypts files using Cryptography API Functions
GDI+: reading and writing metadata in JPEG and TIFF files
How to retrieve information about a cache entry (Internet Explorer)
Monitoring changes occurring within a directory
Using the RestartDialog function -- restarting Windows
Browsing Windows Known Folders (Special Folders)
GDI+ fun: roach-infested desktop
How to suspend or hibernate your system
Pocket PC: base class
Round FoxPro form
Starting external program from VFP and waiting for its termination
The window and its ancestors
Using vendor-neutral SQL constructs
Adding printer to the list of supported printers for the specified server
Copying strings through the global memory block
How to generate GUID values
How to hot-track menu item selection in top-level form (requires VFP9)
How to make the caption of a VFP application flashing in the Windows task bar
Removing FTP directory
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: 73  
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 (23.20.196.179)
4 sec.Function: 'GetPwrCapabilities'
Function group: 'Power Management'
23.52 min.Example: 'How to check whether the system is 32-bit or 64-bit'
31.6 min.Function: 'MAPIReadMail'
31.65 min.Function: 'FindClose'
Function group: 'File Management'
6.74 hrs.Function: 'GetMenuItemInfo'
Function group: 'Menu'
 Example: 'Enumerating files opened on the network'
6.87 hrs.Example: 'Disabling drawing in the VFP form'
7.2 hrs.
Function group: 'String'
8.01 hrs.Example: 'Mapping and disconnecting network drives'
 Function: 'UpdateResource'
Function group: 'Resource'
Google
Advertise here!