Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using shared memory to exchange data between two FoxPro applications
Winsock: how to retrieve the protocol information corresponding to a protocol name
Enumerating MIDI output devices
How to perform Base64 encoding/decoding using Cryptography API Functions
How to view system icons for the classes installed on the local machine
Obtaining OS memory performance information
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Clipping mouse cursor area
Dial the Net Automatically
Displaying Windows shell folders in TreeView control with Visual FoxPro FLL
Enumerating the subkeys for a given registry key
Retrieving various system metrics
Creating a unique filename based on existing filename
Enhanced GetFont dialog
How to obtain Content-Type value for a file type from the System Registry
Monitoring changes in a directory
Retrieving geometrical parameters of the system desktop window
Retrieving information specific to the current Time Zone
Reading VFP settings from the Windows Registry
Using FillMemory
CryptoAPI: retrieving list of providers
GDI+: Storing DLL icon resources in image files
High-powered ALLTRIM
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Removing FTP directory

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
To run this code you must have an appropriate user level to access the FTP.
 
#DEFINE INTERNET_INVALID_PORT_NUMBER   0 
#DEFINE INTERNET_OPEN_TYPE_DIRECT      1 
#DEFINE INTERNET_SERVICE_FTP           1 
#DEFINE FTP_TRANSFER_TYPE_ASCII        1 
#DEFINE FTP_TRANSFER_TYPE_BINARY       2 
 
    PUBLIC hOpen, hFtpSession 
    DO decl
 
    * select FTP connection providing you an appropriate access level 
    * in all cases it can not be any "anonymous" access 
    IF connect2ftp ("ftp.???.???", "???", "???") 
        lnResult = FtpRemoveDirectory (hFtpSession, "ftptest")
 
        * possible reasons for the directory not being removed:
        * - your access level is not valid
        * - the directory does not exist
        * - the directory is not empty
        IF lnResult = 0
            ? GetLastError()    && usually the error code is 12003
        ENDIF
 
        = InternetCloseHandle (hFtpSession)  
        = InternetCloseHandle (hOpen) 
    ENDIF 
 
PROCEDURE  decl
    DECLARE INTEGER GetLastError IN kernel32 
    DECLARE INTEGER InternetOpen IN wininet.dll;  
        STRING  sAgent,;  
        INTEGER lAccessType,;  
        STRING  sProxyName,;  
        STRING  sProxyBypass,;  
        STRING  lFlags  
 
    DECLARE INTEGER InternetCloseHandle IN wininet.dll INTEGER hInet  
 
    DECLARE INTEGER InternetConnect IN wininet.dll;  
        INTEGER hInternetSession,;  
        STRING  sServerName,;  
        INTEGER nServerPort,;  
        STRING  sUsername,;  
        STRING  sPassword,;  
        INTEGER lService,;  
        INTEGER lFlags,;  
        INTEGER lContext  
 
    DECLARE INTEGER FtpRemoveDirectory IN wininet.dll;
        INTEGER hConnect,;
        STRING  lpszDirectory
RETURN
 
FUNCTION  connect2ftp (strHost, strUser, strPwd) 
    * open access to Inet functions  
    hOpen = InternetOpen ("vfp", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0)  
 
    IF hOpen = 0  
        ? "Unable to get access to WinInet.Dll" 
        RETURN .F. 
    ENDIF 
 
    * connect to FTP  
    hFtpSession = InternetConnect (hOpen, strHost, INTERNET_INVALID_PORT_NUMBER,;  
        strUser, strPwd, INTERNET_SERVICE_FTP, 0, 0)  
 
    IF hFtpSession = 0  
    * close access to Inet functions and exit  
        = InternetCloseHandle (hOpen)  
        ? "FTP " + strHost + " is not available" 
        RETURN .F. 
    ELSE  
        ? "Connected to " + strHost + " as: [" + strUser + ", *****]"  
    ENDIF  
RETURN .T. 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2186 bytes  
Created: 2001-07-25 12:00:00  
Modified: 2008-10-03 15:25:57  
Visits in 7 days: 121  
Listed functions:
FtpRemoveDirectory
GetLastError
InternetCloseHandle
InternetConnect
InternetOpen
Printer friendly API declarations
My comment:


#kwd: sln_ftp.
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 (107.20.129.212)
4.06 hrs.Example: 'How to delete all print jobs for a printer'
8.12 hrs.Example: 'Retrieveing information about the active window (even if it is not owned by the calling process)'
 Example: 'Converting a decimal string to an integer'
10.85 hrs.Function: 'GetIconInfo'
Function group: 'Icon'
16.41 hrs.Function: 'ChooseFont'
18.19 hrs.Example: 'Encapsulating access to the Windows Services in a class'
20.51 hrs.Example: 'Retrieving country-specific dialing information from the Windows Telephony list of countries'
 Example: 'Retrieving information about the main VFP window'
20.9 hrs.Function: 'GetKeyState'
Function group: 'Keyboard Input'
 Example: 'Retrieving a universal form for the drive-based path for a network resource'
Google
Advertise here!