📄 fce4vb_u.txt
字号:
2.0 Library Overview
2.1 Dynamic Link Libraries
FCE4VB includes both Win16 [FCE16] and Win32 [FCE32] dynamic link
libraries (DLL). A DLL is characterized by the fact that it need not
be loaded until required by an application program and that only one
copy of the DLL is necessary regardless of the number of application
programs that use it. Contrast this to a static library which is
bound at link time to each and every application that uses it.
2.2 Compiling Programs
The example programs can be compiled from the Visual Basic
development environment using the provided Visual Basic ".MAK" files,
except for HELLO32, which uses a ".VBP" project file. Choose
"File", then "Open Project" from the main VB menu.
The example program code is stored in VB 3.0 (WIN16) and VB 4.0
(WIN32) formats. All project files (except Hello32) end in "16.MAK"
(eg: FCEVER16.MAK) or "32.MAK" (eg: FCEVER32.MAK).
After opening a project, VB 5.0 (and VB 6.0) users can save the
project files in the VB 5.0 (or VB 6.0) format. When saving the
example programs in VB version 5.0 or 6.0 format, answer "no" if
asked to add the "Microsoft DAO 2.5 library".
Compile and run FCEVER16 (or FCEVER32) as the first example.
2.3 FCE4VB Class
The FCE class "fceClass" (fceClass.cls) is a Visual Basic class
wrapper for making calls to FCE32.DLL. The class name for each
function is the same as the DLL function, except the leading "fce" is
replaced by "f".
Those functions that return strings do so by use of the "String
Result" property. Instantiate fceClass as any other class in VB:
Dim X As New fceClass
Also see the FCE4VB Reference Manual (FCE4VB_R.TXT), the example
project "Hello32" and the file fceClass.txt.
Use of fceClass is limited to Visual Basic 5.0 and above.
FCE4VB Users Manual Page 7
3.0 Using the FCE Library
The FCE library is divided into nine classes of functions, as
follows:
(1) The fceAttach and fceRelease functions are used to initialize and
terminate the FCE system. fceAttach should be the very first FCE
function called and fceRelease must be the last FCE function called.
The first argument to fceAttach is the maximum number of threads that
will be started. Use 1 for non-threaded applications. The first
argument to most of the other FCE functions will be the channel (or
thread) number. Up to 32 threads can be run simultaneously. Threads
are numbered starting at 0. The second argument to fceAttach is the
keycode. See Section 4.3, "Key Codes".
(3) The fceConnect function is used to connect to a FTP server. The
fceClose function terminates the connection to the FTP server, after
which another connection can be made. There should be one fceClose
for every fceConnect.
(4) The FCE functions fceSetLocalDir and fceGetLocalDir are used to
set and display the local directory to be used for uploading and
downloading files. They affect only the client computer. Nothing is
sent or received from the FTP server.
(5) The FCE function fceSetServerDir and fceGetServerDir are used to
set and display the server directory from which all subsequent
uploads and downloads will occur. The FCE functions fceMakeServerDir
and fceDelServerDir are used to create and delete server directories.
(6) The FCE function fceGetList is used to get a list of files from
the FTP server. Both name lists and full directory lists can be
retrieved.
(7) The FCE function fceSetMode is used to set the transfer mode to
either ASCII or binary for all subsequent file transfers.
(8) The FCE functions fceGetFile and fcePutFile are used for
downloading and uploading files. Note that the default is ASCII.
(9) The FCE functions fceMakeServerDir and fceDelServer directory are
used to create and remove directories on the server. Of course, this
requires that you have permission. This is almost never the case when
connecting as an anonymous user.
FCE4VB Users Manual Page 8
4.0 Application Notes
4.1 FTP Basics
The FTP (File Transfer Protocol) protocol is defined by Internet
document RFC 959. It is used to copy files between a FTP client and a
FTP server over a TCP/IP connection using well known port 21.
In order to connect to a FTP server, the server name (or IP address),
the user name, and the user password must be known. This is known as
private (or protected) access.
Some FTP servers allow "anonymous" access, which is usually download
only. The convention for anonymous access is to use the word
"anonymous" for the user name, and the callers email address for the
password. Many FTP servers will also accept "ftp" instead of
"anonymous".
FCE4VB supports "Passive" mode. Passive mode is often necessary in
order to get past a firewall to access the server. Passive mode can
be enabled by calling fceSetInteger(Chan, FCE_SET_PASSIVE, 1).
4.2 Auto Dial
To allow Dial-Up Networking (DUN) to dial up your ISP when you access
the Winsock:
(1) Open the DUN folder in "My Computer", and choose
"Connections/Settings" from menu bar. Uncheck "prompt for information
before dialing" and choose "Don't prompt to use Dial-Up Networking".
(2) Use the Windows REGEDIT program to change value "00 00 00 00" to
the value "00 00 00 01" in the Windows Registry for the entry
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet
Settings/EnableAutodial.
(3) Use the Windows REGEDIT program to change value "00 00 00 00" to
the value "00 00 00 01" in the Windows Registry for the entry
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet
Settings/EnableAutodisconnect.
(4) Use the Windows REGEDIT program to change value "14 00 00 00" to
the value "01 00 00 00" in the Windows Registry for the entry
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet
Settings/DisconnectIdleTime. This changes the idle time (until
disconnect) from 20 minutes (hex 14) to one minute.
4.3 Key Codes
When you register FCE, you will receive a new set of DLL's and a key
code for your DLL's. Pass this keycode as the second argument to
fceAttach. The keycode will be found in the file KEYCODE.BAS. The
keycode for the shareware version is 0.
FCE4VB Users Manual Page 9
5.0 Theory Of Operation
The FTP Client Engine is state driven. This means that each call to
FCE functions (that access the server) is broken down into sequential
steps, each of which can be performed within a second or two.
There are two ways in which FCE is used: (1) indirect use of the
state engine, and (2) direct use of the state engine.
5.1 Indirect Method
The first (or "indirect") way to use the FCE library is to allow all
FCE function calls to automatically call the FCE driver (fceDriver)
before returning. This is the default way that FCE operates.
The major advantage of this approach is that each FCE function
returns only after it has completely finished. The disadvantage of
this approach is that some functions may run for a considerable
amount of time during which time the calling application must wait.
Refer to the sample program WINFTP for an example of this approach.
5.2 Direct Method
The second (or "direct") way that the FCE state driver is used is to
call it (fceDriver) directly. In order to operate this way, the
function fceSetInteger must be called which sets the AUTO_CALL flag
to off:
Code = fceSetInteger(Chan, FCE_AUTO_CALL_DRIVER, 0)
After the above statement is executed, the state driver (fceDriver)
must be called after all other FCE functions that access the server.
For example,
Code = fceConnect(...)
If Code < 0 Then
' handle error here
End if
DO
' call the driver
Code = fceDriver
If Code < 0 Then
' handle error here
End If
If Code = 0 Then
Exit Do
End If
' ... do something here ...
LOOP
The major advantage of the direct approach is that the calling
application can perform other work such as reporting the progress of
large downloads. The disadvantage is the extra code that must be
written to call fceDriver.
FCE4VB Users Manual Page 10
6.0 Versions of FCE
The FTP Client Engine (FCE) library is available in three versions.
All three versions have identical functionality.
6.1 Shareware Version
The shareware version can be differentiated from the other two
versions by:
(1) The shareware reminder screen is displayed at startup.
(2) The DLL is branded with "SHAREWARE VERSION".
The Shareware version may NOT be used for commercial purposes.
6.2 Student Version
The student version can be differentiated from the other two versions
by:
(1) There is no shareware reminder screen.
(2) The DLL is branded with "STUDENT VERSION".
The Student version may NOT be used for commercial purposes. Refer to
Section 10.3, Student Version.
6.3 Professional Version
The professional version can be differentiated from the other two
versions by:
(1) There is no shareware reminder screen.
(2) The DLL is branded with your company name.
The professional version may be distributed with your application as
specified by the software license.
FCE4VB Users Manual Page 11
7.0 Using FCE with Other Languages
The FTP Client Engine DLLs can be used with any application written
in any language capable of calling the Windows 16-bit or 32-bit API.
FCE4VB can also be used in VBA applications such as WORD, EXCEL and
ACCESS. Note that WORD97, ACCESS 97, and EXCEL 97 are 32-bit
applications. Refer to VBA16.TXT, MODULE16.BAS, VBA32.TXT, and
MODULE32.BAS.
Also note that there is a C/C++ version (FCE4C).
Delphi (FCE4D), PowerBASIC (FCE4PB), Visual FoxPro (FCE4FP), and
Visual dBase (FCE4DB) versions of FCE are in currently development
(August 1999).
If you have interfaced FCE to an unusual language, email us the
declaration file!
8.0 Problems
Before attempting to run any of the example programs, you should
already be able to connect to the Internet.
If you cannot get your application to run properly, first compile and
run the example programs. If you call us to report a possible bug in
the library, the first thing we will ask is if the example programs
run correctly.
Be sure to test the code returned from FCE functions. Then, call
fceErrorText to get the text associated with the error code.
For example:
Dim Buffer As String * 65
Code = fceConnect(0,"ftp.isp.net","ftp","<you@isp.net>")
If Code < 0 Then
Code = fceErrorText(Code,Buffer,64)
Print "Error " & Str$(Code) & Left$(Buffer, Code)
End If
If you encounter a problem that you cannot resolve, give us a call or
email us at support@marshallsoft.com.
FCE4VB Users Manual Page 12
9.0 Example Programs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -