Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Subclassing CommandButton control to create BackColor property
Obtaining names and positions for shortcuts located on the Windows Desktop
How to put a vertical text scrolling on the form (a movie cast)
How to make a VFP form fading out when released (GDI version)
Enumerating devices installed on the local machine
GDI+: Implementing image scrolling with inertia
Printing text with the Escape function
Displaying dimmed window behind VFP top-level form
Moving shortcut to a specified position on the Windows Desktop
System Image List Viewer
Storing content of the Clipboard to a bitmap file
How to put a horizontal text scrolling on the form (a news line, marquee)
Vertical Label control
How to play AVI file on the _screen
Custom FTP Class for Visual FoxPro application
Creating a console window for Visual FoxPro application
Monitoring clipboard content changes (VFP9)
Detecting changes in connections to removable drives (VFP9)
Mapping and disconnecting network drives
Passing data records between VFP applications via the Clipboard
How to detect if additional monitor is connected and active
Testing Clipboard functions: emptying the clipboard
Custom FTP Class for Visual FoxPro application

User rating: 10/10 (2 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:
Programming File Transfer Protocol in Visual FoxPro

The class implements basic FTP operations: connection, directories, downloading and uploading files. All functionality comes from the Microsoft Wininet API library.

Simple FTP manager form built on this class:

Here is a sample code that uses this class.

The interface:
FUNCTION FtpConnect(lcHost, lcUsr, lcPswd)
PROCEDURE FtpDisconnect
PROPERTY IsConnected

FUNCTION GetCurrentDir
FUNCTION SetCurrentDir(lcDir)

FUNCTION RemoveDir(lcDir)
FUNCTION CreateDir(lcDir)
FUNCTION DirExists(lcDir)

FUNCTION Dir2Cursor(lcCursor)

FUNCTION PutToFtp(lcLocalFile, lcRemoteFile, lnChunkSize)
FUNCTION GetFromFtp(lcRemoteFile, lcLocalFile, lnChunkSize)

FUNCTION BeforePutFile(lcLocalFile, lcRemoteFile)
PROCEDURE AfterPutFile(lcLocalFile, lcRemoteFile, lResult)
PROCEDURE OnPutChunk(lcLocalFile, lcRemoteFile, lnBytesWritten)

FUNCTION BeforeGetFile(lcRemoteFile, lcLocalFile)
PROCEDURE AfterGetFile(lcRemoteFile, lcLocalFile, lResult)
PROCEDURE OnGetChunk(lcRemoteFile, lcLocalFile, lnBytesWritten)

See also:
  • Winsock: accessing FTP
  • Using FTPCommand

    More advanced VFP-based FTP solution:
    Download FTP Class Library
      Members area. Log in to view this example.
      User name:
      Forgot your password?
      Sign up for
    the Membership

    User rating: 10/10 (2 votes)
    Rate this code sample:
    • ~
    14272 bytes  
    Created: 2002-11-22 12:28:17  
    Modified: 2010-01-02 14:42:15  
    Visits in 7 days: 295  
    Listed functions:
    Printer friendly API declarations
    My comment:
    Because of the VFP one-process and one-thread nature such FTP class -- under some circumstances -- is able to freeze the whole VFP application. With less reliable FTP connections I would choose an external library allowing to drop a frozen FTP connection.

    * * *
    To create a passive data connection to an FTP server, use INTERNET_FLAG_PASSIVE for dwFlags parameter in the InternetConnect call:


    nFlags = INTERNET_FLAG_PASSIVE && use 0 for the active mode

    hConnection = InternetConnect(m.hInternet,,;
            m.usr, m.cPsw, INTERNET_SERVICE_FTP, m.nFlags, 0)

    #kwd: sln_ftp.
    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 (
    19 sec.
    Function group: 'Message and Message Queue'
    37 sec.Function: 'GetTextCharacterExtra'
    Function group: 'Font and Text'
    54 sec.Function: 'InternetCheckConnection'
    Function group: 'Internet Functions (WinInet)'
    1.18 min.Articles
    1.47 min.Function: 'CeRapiFreeBuffer'
    Function group: 'Remote Application Programming (RAPI)'
    1.75 min.Function: 'ReadConsole'
    2.03 min.Function: 'PathFindExtension'
    Function group: 'Shell Lightweight Utility APIs -- Path Functions'
    2.28 min.Function: 'FreeConsole'
    Function group: 'Console'
    2.83 min.Updates
    3.12 min.Example: 'Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera'
    Advertise here!