FTP Client Engine Library for PowerBASIC


Programmer's Manual


(FCE4PB)


Version 2.0

June 8, 2000



This software is provided as-is. There are no warranties, expressed or implied.



Copyright (C) 2000 All rights reserved



MarshallSoft Computing, Inc. Post Office Box 4543 Huntsville AL 35815



Voice : 256-881-4630

FAX : 256-880-0925

email : info@marshallsoft.com

web : www.marshallsoft.com



MarshallSoft is a member of the Association of Shareware Professionals

MARSHALLSOFT is a registered trademark of MarshallSoft Computing.



TABLE OF CONTENTS


1 Introduction
1.1 Documentation Set
1.2 Example Program
1.3 Installation
1.4 Uninstalling
1.5 Ordering
1.6 Updates
2 Compiler Issues
2.1 Compiling Programs
2.2 DLL Compiler
2.3 Key Code
3 Example Programs
3.1 FCEVER
3.2 LIST
3.3 FIELDS
3.4 GETPRO
3.5 WINFTP
4 Revision History

1 Introduction

FCE4PB is the easiest way to write FTP applications in PowerBASIC! FCE can be used for both anonymous and private FTP sessions.

A simple interface allows connecting to a FTP server, navigating its directory structure, listing files, sending files, deleting files, and receiving files using the FTP protocol.

With FCE4PB, you can write GUI or console mode programs that easily:

FCE4PB supports all versions of the PowerBASIC Console Compiler (PBCC) and DLL Compiler.

FCE4PB is implemented as a Win32 DLL (Dynamic Link Library). FCE4PB can be used with Windows 95/98 and NT/2000. The FCE4PB DLL (FCE32.DLL) can also be used from any language (C/C++, WORD, ACCESS, EXCEL, PowerBASIC Console/DLL Compiler, Delphi, Visual FoxPro, Visual dBase, COBOL, Fortran, etc.) capable of calling the Windows API.

When comparing FCE against our competition, note that:

1.1 Documentation Set

The complete set of documentation consists of three manuals in three formats. This is the first manual (FCE4PB) in the set.

Each manual comes in three formats:

The FCE User’s Manual (FCE_USR) discusses FTP processing as well as language independent programming issues. Read this manual after reading the FCE4PB Programmer’s Manual. The FCE Reference Manual (FCE_REF) contains details on each individual FCE function.

1.2 Example Program

The following example demonstrates the use of some of the library functions:


FUNCTION PbMain() AS LONG
Dim Code As Integer
Dim User AS ASCIIZ * 50
Dim Pass AS ASCIIZ * 50
Dim Temp As Asciiz * 128

' Set FTP parameters

ServerHost = "ftp.marshallsoft.com"
User = "anonymous"
Pass = "you@traveller.com"

' attach FCE
Code = fceAttach(1, %FCE_KEY_CODE)
If Code < 0 Then
  PRINT "Cannot attach FCE" & Str$(Code)
  Return
End If

' Connect to FTP ServerHost
PRINT "Connecting to ";ServerHost;" as user '";User;"' ...";

Code = fceConnect(0,ServerHost,User,Pass)
IF Code < 0 THEN
  PRINT "Error" & Str$(Code)
  Code = fceRelease()
  Exit Function
ELSE
  PRINT " We are connected!"
END IF

' close and exit
Code = fceClose(0)
Code = fceRelease()

END FUNCTION


In the example program above, fceConnect is called to connect to the FTP server as user "anonymous" and password "msc@traveller.com".

Lastly, the connection to the FTP server is closed and FCE is released.

Refer to the FCE Reference Manual (FCE_REF) for individual function details.


1.3 Installation

  1. Before installation of FCE4PB, your PowerBASIC Console Compiler (or PowerBASIC DLL Compiler) should already be installed on your system and tested.

  2. Create your FCE4PB project directory, copy the FCE4PB archive, and then unzip the archive.

  3. Run INSTALL.BAT which will copy FCE32.DLL to either C:\WINDOWS or C:\WINNT.

  4. You're ready to run! Compile and run FCEVER.BAS first.

Note that the Windows registry is not modified.

1.4 Uninstalling

Uninstalling FCE4PB is very easy. FCE does not modify the registry.

First, run UINSTALL.BAT, which will delete FCE16.DLL and FCE32.DLL from your Windows directory, typically C:\WINDOWS for Windows 95/98 or C:\WINNT for Windows NT/2000.

Second, delete the FCE project directory created when installing FCE4PB.

1.5 Ordering

FCE4PB may be registered for $95. See section "Ordering" in the FCE User’s Manual (FCE_USR) for details on ordering.

1.6 Updates

When you register FCE4PB you will receive a set of registered DLLs plus a license file (FCExxxx.LIC) that can be used to update your registered DLL’s for a period of one year from purchase. Updates can be downloaded from

http://www.marshallsoft.com/oem.htm

After one year, licenses can be updated for $30 for email delivery.


2 Compiler Issues

2.1 Compiling Programs

The example programs are compiled at the command line with the PowerBASIC Console Compiler:

See section 3 "Example programs" for more information on the example programs.

2.2 DLL Compiler

The FCE functions can also be called from programs written for the PowerBASIC DLL Compiler. The same DLL (FCE32.DLL) is used for both PowerBASIC and Visual Basic. FCE functions are defined in FCE32.PBI for PowerBASIC and in FCE32.BAS for Visual Basic. The Visual Basic version can be downloaded from www.marshallsoft.com/fce4vb.htm.

2.3 Key Codes

FCE32.DLL has a keycode encoded within it. Your keycode is a 9 or 10 digit decimal number (unless it is zero), and will be found in the file KEYCODE.PBI. The keycode for the shareware version is 0. You will receive a new key code when registering.

If you get an error message (value -74) when calling fceAttach, it means that the keycode in your application does not match the keycode in the DLL. After registering, it is best to remove the shareware version of the FCE DLL from the Windows search path.

3 Example Programs

Five example programs are included in FCE4PB.

Before writing your own programs, compile and run the example programs.

3.1 FCEVER

The first example program is the program FCEVER (FCE Version) which displays the FCE library version number and registration string.

PBCC FCEVER.BAS

3.2 LIST

The LIST example program connects to a specified FTP server and lists all file. Before compiling, edit LIST.BAS with the appropriate FTP parameters.

PBCC LIST.BAS

3.3 FIELDS

The FIELDS example program connects to a specified FTP server and lists all files by field. Before compiling, edit FIELDS.BAS with the appropriate FTP parameters.

PBCC FIELDS.BAS

3.4 GETPRO

GETPRO is an example program that connects to the MarshallSoft FTP server at

ftp://ftp.marshallsoft.com

and downloads the file PRODUCTS.TXT from the server directory

pub/other

PBCC GETPRO.BAS

3.5 WINFTP

WINFTP is an example FTP application which can be used to connect to a FTP server and upload, download, and delete files. WINFTP is a general purpose FTP client.

PBCC WINFTP.BAS

4 Revision History

The FTP Client Engine DLLs (FCE16.DLL and FCE32.DLL) are written in ANSI C. All language versions of FCE (C/C++, Delphi, PowerBASIC, PowerBASIC, FoxPro, dBase, Xbase++, and COBOL) use the same identical DLLs.

Version 1.2: August 20, 1999

The initial release of the VB version of FCE.

Version 2.0: June 8, 2000