Recibir:
======
// FTPrecibe
#include "Fwce.ch"
//
// File attributes
//
#define FILE_ATTRIBUTE_READONLY Â 1
#define FILE_ATTRIBUTE_HIDDEN Â Â 2
#define FILE_ATTRIBUTE_SYSTEM Â Â 4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE Â 32
#define FILE_ATTRIBUTE_NORMAL Â Â 128
#define FILE_ATTRIBUTE_TEMPORARY 256
//
// access types for InternetOpen()
//
#define INTERNET_OPEN_TYPE_PRECONFIG Â Â Â Â Â Â Â Â Â Â 0 Â // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT Â Â Â Â Â Â Â Â Â Â Â 1 Â // direct to net
#define INTERNET_OPEN_TYPE_PROXY Â Â Â Â Â Â Â Â Â Â Â Â 3 Â // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY Â 4 Â // prevent using java/script/INS
//
// manifests
//
#define INTERNET_INVALID_PORT_NUMBER Â Â 0 Â Â Â Â Â // use the protocol-specific default
#define INTERNET_DEFAULT_FTP_PORT Â Â Â 21 Â Â Â Â Â // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT Â Â 70 Â Â Â Â Â // Â Â " Â Â " gopher "
#define INTERNET_DEFAULT_HTTP_PORT Â Â Â 80 Â Â Â Â Â // Â Â " Â Â " HTTP Â "
#define INTERNET_DEFAULT_HTTPS_PORT Â Â 443 Â Â Â Â // Â Â " Â Â " HTTPS Â "
#define INTERNET_DEFAULT_SOCKS_PORT Â Â 1080 Â Â Â Â // default for SOCKS firewall servers.
//
// service types for InternetConnect()
//
#define INTERNET_SERVICE_FTP Â Â 1
#define INTERNET_SERVICE_GOPHER Â 2
#define INTERNET_SERVICE_HTTP Â Â 3
//
// flags for FTP
//
#define INTERNET_FLAG_TRANSFER_ASCII Â 1
#define INTERNET_FLAG_TRANSFER_BINARY 2
FUNCTION MAIN()
  LOCAL hInternet, hConnect
  hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
  hConnect = INTERNETCONNECT( hInternet, "FTP://LAPERCHA.DYNDNS.ORG", INTERNET_INVALID_PORT_NUMBER, "usuario", "clave", INTERNET_SERVICE_FTP, 0, 0 )
  ? FTPGETFILE( hConnect, "recibe.txt", "recibe.txt", 0, FILE_ATTRIBUTE_ARCHIVE, 0, 0 )
 Â
  INTERNETCLOSEHANDLE( hConnect )
  INTERNETCLOSEHANDLE( hInternet )
  RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
LPWSTR AnsiToWide( LPSTR );
HB_FUNC( INTERNETOPEN )
{
  LPWSTR cAgent = AnsiToWide( hb_parc( 1 ) );
  LPWSTR cProxyName = AnsiToWide( hb_parc( 3 ) );
  LPWSTR cProxyBypass = AnsiToWide( hb_parc( 4 ) );
  HINTERNET hInternet = InternetOpen( cAgent, hb_parnl( 2 ), cProxyName, cProxyBypass, hb_parnl( 5 ) );
  hb_xfree( cAgent );
  hb_xfree( cProxyName );
  hb_xfree( cProxyBypass );
  hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( INTERNETCLOSEHANDLE )
{
  hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}
HB_FUNC( INTERNETCONNECT )
{
  LPWSTR cServerName = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cUserName = AnsiToWide( hb_parc( 4 ) );
  LPWSTR cPassword = AnsiToWide( hb_parc( 5 ) );
  HINTERNET hInternet = InternetConnect( ( HINTERNET ) hb_parnl( 1 ), cServerName, ( INTERNET_PORT ) hb_parnl( 3 ), cUserName, cPassword, hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) );
  hb_xfree( cServerName );
  hb_xfree( cUserName );
  hb_xfree( cPassword );
  hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( FTPGETFILE )
{
  LPWSTR cRemoteFile = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cNewFile = AnsiToWide( hb_parc( 3 ) );
  hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), cRemoteFile, cNewFile, hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
  hb_xfree( cRemoteFile );
  hb_xfree( cNewFile );
}
HB_FUNC( FTPPUTFILE )
{
  LPWSTR cLocalFile = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cNewRemoteFile = AnsiToWide( hb_parc( 3 ) );
  hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), cLocalFile, cNewRemoteFile, hb_parnl( 4 ), hb_parnl( 5 ) ) );
  hb_xfree( cLocalFile );
  hb_xfree( cNewRemoteFile );
}
#pragma ENDDUMPEnvia
=====
// FTPenvia
#include "Fwce.ch"
//
// File attributes
//
#define FILE_ATTRIBUTE_READONLY Â 1
#define FILE_ATTRIBUTE_HIDDEN Â Â 2
#define FILE_ATTRIBUTE_SYSTEM Â Â 4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE Â 32
#define FILE_ATTRIBUTE_NORMAL Â Â 128
#define FILE_ATTRIBUTE_TEMPORARY 256
//
// access types for InternetOpen()
//
#define INTERNET_OPEN_TYPE_PRECONFIG Â Â Â Â Â Â Â Â Â Â 0 Â // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT Â Â Â Â Â Â Â Â Â Â Â 1 Â // direct to net
#define INTERNET_OPEN_TYPE_PROXY Â Â Â Â Â Â Â Â Â Â Â Â 3 Â // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY Â 4 Â // prevent using java/script/INS
//
// manifests
//
#define INTERNET_INVALID_PORT_NUMBER Â Â 0 Â Â Â Â Â // use the protocol-specific default
#define INTERNET_DEFAULT_FTP_PORT Â Â Â 21 Â Â Â Â Â // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT Â Â 70 Â Â Â Â Â // Â Â " Â Â " gopher "
#define INTERNET_DEFAULT_HTTP_PORT Â Â Â 80 Â Â Â Â Â // Â Â " Â Â " HTTP Â "
#define INTERNET_DEFAULT_HTTPS_PORT Â Â 443 Â Â Â Â // Â Â " Â Â " HTTPS Â "
#define INTERNET_DEFAULT_SOCKS_PORT Â Â 1080 Â Â Â Â // default for SOCKS firewall servers.
//
// service types for InternetConnect()
//
#define INTERNET_SERVICE_FTP Â Â 1
#define INTERNET_SERVICE_GOPHER Â 2
#define INTERNET_SERVICE_HTTP Â Â 3
//
// flags for FTP
//
#define INTERNET_FLAG_TRANSFER_ASCII Â 1
#define INTERNET_FLAG_TRANSFER_BINARY 2
FUNCTION MAIN()
  LOCAL hInternet, hConnect
  hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
  hConnect = INTERNETCONNECT( hInternet, "FTP://LAPERCHA.DYNDNS.ORG", INTERNET_INVALID_PORT_NUMBER, "usuario", "clave", INTERNET_SERVICE_FTP, 0, 0 )
  ? FTPPUTFILE( hConnect, "envia.txt", "envia.txt", 0, 0 )
  INTERNETCLOSEHANDLE( hConnect )
  INTERNETCLOSEHANDLE( hInternet )
  RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
LPWSTR AnsiToWide( LPSTR );
HB_FUNC( INTERNETOPEN )
{
  LPWSTR cAgent = AnsiToWide( hb_parc( 1 ) );
  LPWSTR cProxyName = AnsiToWide( hb_parc( 3 ) );
  LPWSTR cProxyBypass = AnsiToWide( hb_parc( 4 ) );
  HINTERNET hInternet = InternetOpen( cAgent, hb_parnl( 2 ), cProxyName, cProxyBypass, hb_parnl( 5 ) );
  hb_xfree( cAgent );
  hb_xfree( cProxyName );
  hb_xfree( cProxyBypass );
  hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( INTERNETCLOSEHANDLE )
{
  hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}
HB_FUNC( INTERNETCONNECT )
{
  LPWSTR cServerName = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cUserName = AnsiToWide( hb_parc( 4 ) );
  LPWSTR cPassword = AnsiToWide( hb_parc( 5 ) );
  HINTERNET hInternet = InternetConnect( ( HINTERNET ) hb_parnl( 1 ), cServerName, ( INTERNET_PORT ) hb_parnl( 3 ), cUserName, cPassword, hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) );
  hb_xfree( cServerName );
  hb_xfree( cUserName );
  hb_xfree( cPassword );
  hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( FTPGETFILE )
{
  LPWSTR cRemoteFile = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cNewFile = AnsiToWide( hb_parc( 3 ) );
  hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), cRemoteFile, cNewFile, hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
  hb_xfree( cRemoteFile );
  hb_xfree( cNewFile );
}
HB_FUNC( FTPPUTFILE )
{
  LPWSTR cLocalFile = AnsiToWide( hb_parc( 2 ) );
  LPWSTR cNewRemoteFile = AnsiToWide( hb_parc( 3 ) );
  hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), cLocalFile, cNewRemoteFile, hb_parnl( 4 ), hb_parnl( 5 ) ) );
  hb_xfree( cLocalFile );
  hb_xfree( cNewRemoteFile );
}
#pragma ENDDUMP