Introduction

The LEADTOOLS Internet features are available only in the LEADTOOLS Internet Imaging Pro toolkit. These features let you add the following capabilities to your application:

send and respond to messages between local and remote computers.

interact with web servers without requiring the use of a Web Browser.

programmatically send and receive files.

The functions for sending and responding to messages between local and remote computers are included in the LTNET14n.dll. For documentation on these functions, refer to the Ltvidlibn.hlp help file.

The functions for interacting with web servers and programmatically sending and receiving files are included in the Internet API DLL, LTWEB14n.dll. These functions are documented in this help file.

Executable demos are included in all LEADTOOLS products. The executable demos provide a quick and easy way to evaluate the Internet features and performance.

The Internet features come in a WIN32 edition so that it can support development of software applications for any of the following environments:

Windows 3.x NT
Windows 4.x NT
Windows 95
Windows 98

Summary of All Supported Image File Formats


Version History

Current version: | 14.5
Last update: | October 20, 2005

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Version 12.1


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS FTP/HTTP Class Library has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS FTP/HTTP Class Library has changed from Version 13 as follows:

LEADTOOLS FTP/HTTP Class Library now supports UNICODE.


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS FTP/HTTP Class Library has not changed from Version 12.1.


Version 12.1

Version 12.1 is the first version of LEADTOOLS FTP/HTTP Class Library.

The rest of this topic lists the new functions in version 12.1.

FTP Functions

LInetFtp::LInetFtp

LInetFtp::~LInetFtp

LInetFtp::Connect

LInetFtp::Disconnect

LInetFtp::SendFile

LInetFtp::GetFile

LInetFtp::RenameFile

LInetFtp::DeleteFile

LInetFtp::CreateDir

LInetFtp::DeleteDir

LInetFtp::GetCurrentDir

LInetFtp::BrowseDir

LInetFtp::ChangeDir

LInetFtp::SendBitmap

LInetFtp::BrowseCallBack

HTTP Functions

LInetHttp::LInetHttp

LInetHttp::~LInetHttp

LInetHttp::Connect

LInetHttp::Disconnect

LInetHttp::OpenRequest

LInetHttp::CloseRequest

LInetHttp::SendBitmap

LInetHttp::SendData

LInetHttp::SendForm

LInetHttp::SendRequest

LInetHttp::GetResponse

LInetHttp::GetServerStatus


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.

Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.

OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
1201 Greenwood Cliff, Suite 400
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
Technical support: (704) 372-9681 or Support@Leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS Internet API

Programming with LEADTOOLS Internet

How to Program with the LInetHttp Class

How to Program with the LInetFtp Functions


How to Program with the LInetFtp Class

The LInetFtp class allows a user to create a connection with an FTP server, transfer files and bitmaps, perform remote file operations, perform remote directory operations, and browse remote directories for files.

The following topics provide a systematic approach to understanding how to program with the LEADTOOLS LInetFtp class.

Connecting and Disconnecting to the FTP Server

The first step in working with an FTP server is to connect to the desired FTP server. A connection can be established when a class object is created using the LInetFtp::LInetFtp constructor, or by calling LInetFtp::Connect. A user can connect with a user name and password, or as an "anonymous" user. To disconnect from the FTP server use the LInetFtp::Disconnect function or the class destructor LInetFtp::~LInetFtp.

File Manipulation

A user can store files on the FTP server via LInetFtp::SendFile. To get a file from the FTP server and store it on the local system, use the function LInetFtp::GetFile. In addition, a remote file on the server can be renamed using LInetFtp::RenameFile. Finally, LInetFtp::DeleteFile can delete a remote file on the server.

Directory Manipulation

A user can create directories on the FTP server via LInetFtp::CreateDir. To delete a directory from an FTP server, use the function LInetFtp::DeleteDir. LInetFtp::ChangeDir changes the working directory on the FTP server. Finally, LInetFtp::GetCurrentDir retrieves the current directory for the specified FTP connection.

Directory Browsing (Search results)

Any directory can be browsed on the FTP server. In addition, a file search can also be performed. Both can be implemented by calling LInetFtp::BrowseDir. The search results can be obtained from LInetFtp::BrowseCallBack. A call to this callback function is automatically generated after calling LInetFtp::BrowseDir.

Uploading a Bitmap to an FTP Server

The LEADTOOLS LInetFtp class supports uploading a LEAD bitmap. Use LInetFtp::SendBitmap function to manage asynchronous uploading of a bitmap.


How to Program with the LInetHttp Class

The LEADTOOLS LInetHttp class functions allow you to connect to Internet servers and issue requests. These functions allow you to interact with Internet servers without requiring the use of an Internet Browser.

The first step in working with an Internet server is to connect to the desired server. A connection can be established when a class object is created using the LInetHttp::LInetHttp constructor, or by calling LInetHttp::Connect. After connecting with the Internet server, designate what page, cgi script, asp script, file, or executable will be the target of the request to the server. Once the target has been decided, call LInetHttp::OpenRequest to open the request to the server. No data can be sent to the Internet server without first calling LInetHttp::OpenRequest.

After a valid request has been opened, several actions can be taken. Simulate a user sending a form to the sever with LInetHttp::SendForm. Send raw data using LInetHttp::SendData. Finally, send a bitmap with LInetHttp::SendBitmap. If it is not necessary to send any particular data, the LInetHttp::SendRequest function can be used to send your request.

Once the request has been sent to the Internet server, the status can be retrieved using LInetHttp::GetServerStatus. If the server sent any data in its response, LInetHttp::GetResponse can be used to get the response data.

After the request is finished, call LInetHttp::CloseRequest to close the request. When no more requests are needed, call LInetHttp::Disconnect to disconnect from the Internet server


FTP/HTTP Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory is created:

REDIST\

Redistributable FTP/HTTP files.

Note: The FTP/HTTP features are provided for evaluation purposes only. You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license.

Note: You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS FTP/HTTP functions on a WIN32 system. (\REDIST\ subdirectory contains copies of these files.)

Please note that LTKRN and LTWVC are required for ALL Class Library applications. For more information on LTKRN, LTWVC and other files for the Main Class Library, refer to Files To Be Included With Your Application.

Redistributables: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTWEB | FTP/HTTP support. LTWEB14N.DLL is the LEADTOOLS FTP/HTTP Support DLL. It contains support for the HTTP and FTP functions. The header file is LTWEB.H. Also requires LTFIL14N.DLL. | DLL: LTWEB14N.DLL Library: LTWEB_N.LIB. | DLL: LTWEB14NU.DLL Library: LTWEB_NU.LIB. | DLL: LTWEB14E.DLL Library: LTWEB_E.LIB. | DLL: LTWEB14EU.DLL Library: LTWEB_EU.LIB.


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

ACROBAT | LEADTOOLS manuals in the PDF format, which you can view and print using Adobe Acrobat. These files are optional and are available when installing from the CD-ROM.
BIN | Executable files for the demonstration programs.
HELP | Online help files.
IMAGES | Sample images and databases containing images.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\OCX | One subdirectory for each example ActiveX program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB | Header files for the Class Library
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


LEADTOOLS Documentation

LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Classes

The Following classes are provided by the LEADTOOLS Internet Class Library:

LInetHttp

LInetFtp


LInetFtp

Description

The LInetFtp class provides FTP Internet functions that allow you to create a connection with an FTP server, transfer files and bitmaps, perform remote file operations, perform remote directory operations, and browse remote directories for files.

Required Libraries

You must load all required libraries using LBase::LoadLibraries before using the classes.

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Class Members, Class Hierarchy Chart


LInetFtp::Class Members

Constructor / Destructor

Connect / Disconnect Operations

Remote File Operations

Remote Directory Operations

Sending Bitmaps

Callbacks

Return to LInetFtp

Constructor / Destructor

LInetFtp::LInetFtp

LInetFtp::~LInetFtp

Connect / Disconnect Operations

LInetFtp::LInetFtp

LInetFtp::Connect

LInetFtp::Disconnect

Remote File Operations

LInetFtp::SendFile

LInetFtp::GetFile

LInetFtp::RenameFile

LInetFtp::DeleteFile

Remote Directory Operations

LInetFtp::CreateDir

LInetFtp::DeleteDir

LInetFtp::GetCurrentDir

LInetFtp::BrowseDir

LInetFtp::ChangeDir

Sending Bitmaps

LInetFtp::SendBitmap

Callbacks

LInetFtp::BrowseCallBack


LInetHttp

Description

The LInetHttp class provides HTTP Internet functions that allow you to create a connection with an HTTP server, and send data to or get data from an HTTP server.

Required Libraries

You must load all required libraries using LBase::LoadLibraries before using the classes.

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Class Members, Class Hierarchy Chart


LInetHttp::Class Members

Constructor / Destructor

Connect / Disconnect Operations

Open / Close Requests

Sending / Getting Data

Return to LInetHttp

Constructor / Destructor

LInetHttp::LInetHttp

LInetHttp::~LInetHttp

Connect / Disconnect Operations

LInetHttp::LInetHttp

LInetHttp::Connect

LInetHttp::Disconnect

Open / Close Requests

LInetHttp::OpenRequest

LInetHttp::CloseRequest

Sending / Getting Data

LInetHttp::SendBitmap

LInetHttp::SendData

LInetHttp::SendForm

LInetHttp::SendRequest

LInetHttp::GetResponse

LInetHttp::GetServerStatus


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
1201 Greenwood Cliff, Suite 400
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Internet Function Groups

HTTP Functions

Connect / Disconnect Operations

Open / Close Requests

Sending / Getting Data

FTP Functions

Connect / Disconnect Operations

Remote File Operations

Remote Directory Operations

Sending Bitmaps

Callbacks


FTP Functions: Connect / Disconnect Operations

FTP Functions:
Connect / Disconnect Operations

LInetFtp::LInetFtp

LInetFtp::~LInetFtp

LInetFtp::Connect

LInetFtp::Disconnect


FTP Functions: Remote File Operations

FTP Functions:
Remote File Operations

LInetFtp::SendFile

LInetFtp::GetFile

LInetFtp::RenameFile

LInetFtp::DeleteFile


FTP Functions: Remote Directory Operations

FTP Functions:
Remote Directory Operations

LInetFtp::CreateDir

LInetFtp::DeleteDir

LInetFtp::GetCurrentDir

LInetFtp::BrowseDir

LInetFtp::ChangeDir


FTP Functions:Sending Bitmaps

FTP Functions:
Sending Bitmaps

LInetFtp::SendBitmap


FTP Functions: Callbacks

FTP Functions:
Callbacks

LInetFtp::BrowseCallBack


HTTP Functions: Connect / Disconnect Operations

HTTP Functions:
Connect / Disconnect Operations

LInetHttp::LInetHttp

LInetHttp::~LInetHttp

LInetHttp::Connect

LInetHttp::Disconnect


HTTP Functions:Open / Close Requests

HTTP Functions:
Open / Close Requests

LInetHttp::OpenRequest

LInetHttp::CloseRequest


HTTP Functions: Sending / Getting Data

HTTP Functions:
Sending / Getting Data

LInetHttp::SendBitmap

LInetHttp::SendData

LInetHttp::SendForm

LInetHttp::SendRequest

LInetHttp::GetResponse

LInetHttp::GetServerStatus


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

Internet Structures

L_FILETIME

NAMEVALUE


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a Boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


L_FILETIME

The L_FILETIME structure holds an unsigned 64-bit date and time value for a file. This value represents the number of 100-nanosecond units since the beginning of January 1, 1601.

Member | Data Type | Description
dwLowDateTime | DWORD | Low-order 32 bits of the file time value.
dwHighDateTime | DWORD | High-order 32 bits of the file time value.


NAMEVALUE

typedef struct tagNAMEVALUE
{
L_TCHAR L_FAR *pszName;
L_TCHAR L_FAR *pszValue;
} NAMEVALUE, L_FAR *pNAMEVALUE;

The NAMEVALUE structure serves as the working structure for name items on a form. When sending a form or bitmap it allows you to specify the HTTP form element.

Member | Description
pszName | Name of a HTTP form item.
pszValue | Value of an HTTP form item.

Comments

pNAMEVALUE is a pointer to a NAMEVALUE structure. Generally, where a function parameter type is pNAMEVALUE, you can declare a NAMEVALUE variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pNAMEVALUE variable is necessary only if your program requires a pointer.

See Also

Functions:

LInetHttp::SendBitmap,LInetHttp::SendData, LInetHttp::SendForm


Return Codes

For a list of all possible error codes for LEADTOOLS FTP/HTTP Class Library, refer to LEADTOOLS Class Library Error Codes in the Main Class Library.


LInetFtp::LInetFtp

#include "ltwrappr.h"

L_VOID LInetFtp::LInetFtp(L_VOID)

L_VOID LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21)

L_TCHAR L_FAR *pszServer; | /* name of server to connect to */
L_TCHAR L_FAR *pszUserName; | /* username for authentication */
L_TCHAR L_FAR *pszPassword; | /* password for authentication */
L_INT nPort; | /* port number to connect to */

Constructs and initializes the member variables of the LInetFtp object.

Parameter | Description
pszServer | Character string that contains the host name of an FTP server. This can be a URL, like ftp.leadtools.com, or it can contain the IP number of the site, in ASCII dotted-decimal format (for example, 208.35.195.11).
pszUserName | Character string that contains the name of the user logging on. Default value is NULL. This is a NULL-terminated string.
pszPassword | Character string that contains the password to use when logging on. Default value is NULL. This is a NULL-terminated string.
nPort | Number of the TCP/IP port on the server to connect to. These flags set only the port that will be used. Use the default port for FTP servers: INTERNET_DEFAULT_FTP_PORT (port 21).

Returns

None

Comments

LInetFtp::LInetFtp() is the default LInetFtp constructor. After calling the this constructor, a user must call LInetFtp::Connect to establish a connection before using other functions.

LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21) is a constructor for the LInetFtp object. It connects to the FTP server. If both pszUserName and pszPassword are NULL, the connection is made anonymously.

A connection to an FTP server must be established before using any other FTP functions. If a connection is disconnected, via either LInetFtp::Disconnect or LInetFtp::~LInetFtp, then a connection must be re-established before any other FTP functions are called. LInetFtp::Connect and LInetFtp::LInetFtp can be used to establish a connection with an FTP server.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::~LInetFtp, LInetFtp::Connect, Class Members
Topics: | FTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetFtp Class

Example

//This example for LInetFtp::LInetFtp(L_VOID)

// This will call the default constructor and destructor
 when it is out of scope

LInetFtp InetFtp();

// other code

//-----------------------------------------------------------------------------------------------------------------------

/*This example for LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21)*/

// This example simulates storing a file on an FTP server

L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszSourceFileName,
 L_TCHAR L_FAR *pszDistFileName)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.CreateDir
 (TEXT("MyDirName")) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 create a directory"));
return;
}

if(InetFtp.SendFile
 (pszSourceFileName, pszDistFileName, SENDAS_BINARY) != SUCCESS)
{

      InetFtp.DeleteDir
 (TEXT("MyDirName"));
InetFtp. DisplayError  (hWndParent, TEXT("Error
 while send the file"));
return;
}
}


LInetFtp::~LInetFtp

#include "ltwrappr.h"

virtual L_VOID LInetFtp::~LInetFtp(L_VOID)

Destroys the object and frees any resources associated with it.

Returns

None

Comments

This is the destructor for the LInetFtp class. It destroys the class object, and disconnects the connection with the FTP server.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::LInetFtp, Class Members
Topics: | FTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::LInetFtp.


LInetFtp::BrowseCallBack

#include "ltwrappr.h"

virtual L_INT LInetFtp::BrowseCallBack(pszFile, uFileAttrib, ftCreateTime, ftLastAccessTime, ftLastWriteTime, uFileSize)

L_TCHAR L_FAR *pszFile; | /* file name */
L_INT32 uFileAttrib; | /* attributes of the file found */
L_FILETIME ftCreateTime; | /* creation time*/
L_FILETIME ftLastAccessTime; | /* last access time */
L_FILETIME ftLastWriteTime; | /* last write time */
L_UINT32 uFileSize; | /* file size*/

Handles the data generated by calling the LInetFtp::BrowseDir function.

Parameter | Description
pszSearch | Character string that contains the file name. This is a NULL terminated string.
uFileAttributes | Specifies the file attributes of the file that was found. Possible values are:
 | Value | Meaning
 | FTP_FILE_ATTRIBUTE_ARCHIVE | The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.
 | FTP_FILE_ATTRIBUTE_COMPRESSED | The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.
 | FTP_FILE_ATTRIBUTE_DIRECTORY | The handle identifies a directory.
 | FTP_FILE_ATTRIBUTE_ENCRYPTED | The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.
 | FTP_FILE_ATTRIBUTE_HIDDEN | The file or directory is hidden. It is not included in an ordinary directory listing.
 | FTP_FILE_ATTRIBUTENORMAL | The file or directory has no other attributes set. This attribute is valid only if used alone.
 | FTP_FILE_ATTRIBUTE_OFFLINE | The file data is not immediately available. This attribute indicates that the file data has been physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software in Windows 2000. Applications should not arbitrarily change this attribute.
 | FTP_FILE_ATTRIBUTE_READONLY | The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
 | FTP_FILE_ATTRIBUTE_REPARSE_POINT | The file has an associated reparse point.
 | FTP_FILE_ATTRIBUTE_SPARSE_FILE | The file is a sparse file.
 | FTP_FILE_ATTRIBUTE_SYSTEM | The file or directory is part of the operating system or is used exclusively by the operating system.
 | FTP_FILE_ATTRIBUTE_TEMPORARY | The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access, rather than flushing it back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
ftCreationTime | Specifies an L_FILETIME structure containing the time the file was created.
FtLastAccessTime | Specifies an L_FILETIME structure containing the time that the file was last accessed.
ftLastWriteTime | Specifies an L_FILETIME structure containing the time that the file was last written.
uFileSize | Specifies the file size in bytes.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

LInetFtp::BrowseCallBack receives the results of a file search or from browsing a directory.

A call to this callback function is generated when LInetFtp::BrowseDir is called.

This function must return SUCCESS in order to continue browsing a directory.

To use the LInetFtp::BrowseCallBack function, you must derive a class from LInetFtp and override the LInetFtp::BrowseCallBack member function.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::BrowseDir, Class Members
Topics: | FTP Functions: Callbacks
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::BrowseDir.


LInetFtp::BrowseDir

#include "ltwrappr.h"

L_INT LInetFtp::BrowseDir(pszSearch = NULL)

L_TCHAR L_FAR *pszSearch;

/* valid directory path or file name */

Browses a specific directory or searches for a specific file on an FTP server's file system.

Parameter | Description
pszSearch | Character string that contains a valid directory path or file name for the FTP server's file system. The string can contain wildcards, but no blank spaces are allowed. If the value of pszSearch is NULL or if it is an empty string, it will find the first file in the current directory on the server. This is a NULL-terminated string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

LInetFtp::BrowseCallBack function will be called automatically after calling LInetFtp::BrowseDir, to process the search/browse results. For more information about the information passed to the callback function, refer to LInetFtp::BrowseCallBack.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::CreateDir, LInetFtp::DeleteDir, LInetFtp::GetCurrentDir, LInetFtp::ChangeDir, Class Members
Topics: | FTP Functions: Remote Directory Operations
 | How to Program with the LInetFtp Class

Example

//This example connects to an ftp server and browses a directory.
 If found it adds files to a list.
// The user should derive a class from LInetFtp to support the BrowseCallBack
 function
// suppose it was named as LUserInetFtp

class LUserInetFtp : public LInetFtp
{
public:
LUserInetFtp(L_TCHAR L_FAR *pszServer,
 L_TCHAR L_FAR *pszUserName = NULL,
L_TCHAR L_FAR *pszPassword = NULL,
 L_INT nPort = 21);

protected:
virtual L_INT BrowseCallBack(L_TCHAR
 L_FAR *pszFile,       L_INT32 uFileAttrib,
L_FILETIME ftCreateTime, L_FILETIME
 ftLastAccessTime,
L_FILETIME ftLastWriteTime, L_UINT32
 uFileSize);
};

L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszDirName)
{
LUserInetFtp UserInetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(UserInetFtp. GetErrorFromList

 () != SUCCESS)
{
UserInetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(UserInetFtp.BrowseDir(pszDirName)
 != SUCCESS)
{
UserInetFtp.DisplayError(hWndParent,
 TEXT("Can't browse the remote directory"));
return;
}
}

LUserInetFtp::LUserInetFtp(L_TCHAR L_FAR *pszServer, L_TCHAR L_FAR *pszUserName,
 L_TCHAR L_FAR *pszPassword, L_INT nPort)
{
}

L_INT LUserInetFtp::BrowseCallBack(L_TCHAR
 L_FAR *pszFile, L_INT32 uFileAttrib, L_FILETIME ftCreateTime, L_FILETIME
 ftLastAccessTime, L_FILETIME ftLastWriteTime, L_UINT32 uFileSize)
{
MessageBox(NULL, pszFile, TEXT("FTP Browsing"),
 MB_OK);
return SUCCESS;
}


LInetFtp::ChangeDir

#include "ltwrappr.h"

L_INT LInetFtp::ChangeDir(pszDirectory)

L_TCHAR L_FAR *pszDirectory;

/* name of the directory */

Changes the working directory on the FTP server.

Parameter | Description
pszRemote | Character string that contains the name of the directory to change to on the remote system. This can be either a fully qualified path or a name relative to the current directory. This is a NULL-terminated string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Changes to a different working directory on the FTP server.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::CreateDir, LInetFtp::DeleteDir, LInetFtp::BrowseDir, LInetFtp::GetCurrentDir, Class Members
Topics: | FTP Functions: Remote Directory Operations
 | How to Program with the LInetFtp Class

Example

// This example changes the current remote directory on a FTP server

L_VOID TestFunction(HWND hWndParent)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.ChangeDir(TEXT("MyDir1"))
 != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 change a remote directory, an error within the server"));
return;
}
}


LInetFtp::Connect

#include "ltwrappr.h"

L_INT LInetFtp::Connect(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21)

L_

L_TCHAR L_FAR *pszServer; | /* name of server to connect to */
L_TCHAR L_FAR *pszUserName; | /* username for authentication */
L_TCHAR L_FAR *pszPassword; | /* password for authentication */
L_INT nPort; | /* port on the server to connect to */

Connects to the specified FTP server.

Parameter | Description
pszServer | Character string that contains the host name of an FTP server. This can be a URL, like ftp.leadtools.com, or it can contain the IP number of the site, in ASCII dotted-decimal format (for example, 208.35.195.11). This is a NULL-terminated string.
pszUserName | Character string that contains the name of the user logging on. Default value is NULL. This is a NULL-terminated string.
pszPassword | Character string that contains the password to use when logging on. If both pszPassword and pszUsername are NULL, the connection is made anonymously.
nPort | Number of the TCP/IP port on the server to connect to. These flags set only the port that will be used. Use the default port for FTP servers: INTERNET_DEFAULT_FTP_PORT (port 21).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

A connection to an FTP server must be established before using any other FTP functions. If a connection is disconnected, via either LInetFtp::Disconnect or LInetFtp::~LInetFtp, then a connection must be re-established before any other FTP functions are called. LInetFtp::Connect and LInetFtp::LInetFtp can be used to establish a connection with an FTP server.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::LInetFtp, LInetFtp::Disconnect, LInetFtp::SendFile, LInetFtp::GetFile, LInetFtp::RenameFile, LInetFtp::DeleteFile, LInetFtp::CreateDir, LInetFtp::DeleteDir, LInetFtp::GetCurrentDir, LInetFtp::BrowseDir, LInetFtp::ChangeDir, LInetFtp::SendBitmap, Class Members
Topics: | FTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetFtp Class

Example

L_VOID TestConnect(HWND hWndParent)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

// Another code

   InetFtp.Disconnect ();

if(InetFtp.Connect(TEXT("www.leadtools.com"),
 TEXT("ABC"), TEXT("XYZ")) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 connect to the FTP server, user-name or password may invalid!!"));
return;
}
}


LInetFtp::CreateDir

#include "ltwrappr.h"

L_INT LInetFtp::CreateDir(pszDirectory)

L_TCHAR L_FAR *pszDirectory;

/* name of the directory to create */

Creates a new directory on the FTP server.

Parameter | Description
pszDirectory | Character string that contains the name of the directory to create on the FTP server. This can be either a fully qualified path or a name relative to the current directory. This is a NULL-terminated string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

A new directory will be created on the FTP server.

If the directory specified in pszDirectory already exists on the FTP server, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::DeleteDir, LInetFtp::GetCurrentDir, LInetFtp::BrowseDir, LInetFtp::ChangeDir, Class Members
Topics: | FTP Functions: Remote Directory Operations
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::LInetFtp.


LInetFtp::DeleteDir

#include "ltwrappr.h"

L_INT LInetFtp::DeleteDir(pszDirectory)

L_TCHAR L_FAR *pszDirectory;

/* name of the directory to remove */

Removes the specified directory on the FTP server.

Parameter | Description
pszDirectory | Character string that contains the name of the directory to remove on the FTP server. This can be either a fully qualified path or a name relative to the current directory. This is a NULL-terminated string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Deletes the specified directory from the FTP server.

If the directory specified in pszDirectory does not exist on the FTP server, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::CreateDir, LInetFtp::GetCurrentDir, LInetFtp::BrowseDir, LInetFtp::ChangeDir, Class Members
Topics: | FTP Functions: Remote Directory Operations
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::LInetFtp.


LInetFtp::DeleteFile

#include "ltwrappr.h"

L_INT LInetFtp::DeleteFile(pszRemote)

L_TCHAR L_FAR *pszRemote;

/* name of the file to delete */

Deletes a file stored on the FTP server.

Parameter | Description
pszRemote | Character string that contains the name of the file to delete on the FTP server.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::SendFile, LInetFtp::GetFile, LInetFtp::RenameFile, Class Members
Topics: | FTP Functions: Remote File Operations
 | How to Program with the LInetFtp Class

Example

// This example deletes a remote file on an FTP server

L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszRename)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.DeleteFile
 (pszRename) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 delete a remote file, an error within the server"));
return;
}
}


LInetFtp::Disconnect

#include "ltwrappr.h"

L_VOID LInetFtp::Disconnect(L_VOID)

Disconnects a connection with the FTP server.

Returns

None

Comments

The function terminates any pending operations, and discards any outstanding data.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::LInetFtp, LInetFtp::Connect, Class Members
Topics: | FTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::LInetFtp.


LInetFtp::GetCurrentDir

#include "ltwrappr.h"

L_INT LInetFtp::GetCurrentDir(pszDirectory, ulSize = MAX_PATH)

L_TCHAR L_FAR *pszDirectory; | /* character string to be updated */
L_UINT32 ulSize; | /* length, in characters, of the buffer for the current directory string */

Retrieves the current directory for the FTP connection.

Parameter | Description
pszDirectory | Character string to be updated with the current directory string, which specifies the absolute path to the current directory. The string is NULL-terminated. This parameter cannot be NULL.
ulSize | A variable that specifies the length, in characters, of the buffer for the current directory string. The buffer length must include room for a terminating NULL character. Using a length of MAX_PATH is sufficient for all paths.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Retrieves the current directory.

If the pszDirectory parameter is NULL, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::CreateDir, LInetFtp::DeleteDir, LInetFtp::BrowseDir, LInetFtp::ChangeDir, Class Members
Topics: | FTP Functions: Remote Directory Operations
 | How to Program with the LInetFtp Class

Example

// This example gets the current remote directory from an FTP server

L_VOID TestFunction(HWND hWndParent)
{
L_TCHAR szRemoteDir[MAX_PATH];

LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.GetCurrentDir(szRemoteDir)
 != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 get a remote directory name, an error within the server"));
return;
}
}


LInetFtp::GetFile

#include "ltwrappr.h"

L_INT LInetFtp::GetFile(pszRemote, pszLocal, uSendAs, bOverwrite = TRUE)

L_TCHAR L_FAR *pszRemote; | /* name of the file to retrieve */
L_TCHAR L_FAR *pszLocal; | /* name of the file to create */
L_UINT uSendAs; | /* file transfer flag */
L_BOOL bOverwrite; | /* file overwriting flag*/

Retrieves a file from the FTP server and stores it under the specified file name, locally.

Parameter | Description
pszRemote | Character string that contains the name of the file to retrieve from the FTP server. This is a NULL-terminated string.
pszLocal | Character string that contains the name of the file to create on the local system. This is a NULL-terminated string.
uSendAs | Flag that indicates the conditions under which the transfers occur. Possible values are:
 | Value | Meaning
 | SENDAS_ASCII | Transfers the file as ASCII
 | SENDAS_BINARY | Transfers the file as BINARY
bOverwrite | Boolean flag that indicates whether the function should proceed if a local file of the specified name already exists. Possible values are:
 | Value | Meaning
 | TRUE | The local file will be overwritten.
 | FALSE | If the file already exists locally, then do not store the file locally.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::SendFile, LInetFtp::RenameFile, LInetFtp::DeleteFile, Class Members
Topics: | FTP Functions: Remote File Operations
 | How to Program with the LInetFtp Class

Example

// This example gets a remote file from an FTP server

L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszRemote,
 L_TCHAR L_FAR *pszLocal)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.GetFile(pszRemote,
 pszLocal, SENDAS_BINARY) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 get a remote file, an error within the server"));
return;
}
}


LInetFtp::RenameFile

#include "ltwrappr.h"

L_INT LInetFtp::RenameFile(pszOldName, pszNewName)

L_TCHAR L_FAR *pszOldName; | /* old file name */
L_TCHAR L_FAR *pszNewName; | /* new file name */

Renames a file stored on the FTP server.

Parameter | Description
pszOldName | Character string that contains the name of the file that will have its name changed on the remote FTP server. This is a NULL-terminated string.
pszNewName | Character string that contains the new name for the remote file. This is a NULL-terminated string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If the file specified in pszNewName already exists, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::SendFile, LInetFtp::GetFile, LInetFtp::DeleteFile, Class Members
Topics: | FTP Functions: Remote File Operations
 | How to Program with the LInetFtp Class

Example

// This example renames a remote file on an FTP server

L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszOld,
 L_TCHAR L_FAR *pszNew)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList
 ()
 != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.RenameFile(pszOld,
 pszNew) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 rename a remote file, an error within the server"));
return;
}
}


LInetFtp::SendBitmap

#include "ltwrappr.h"

L_INT LInetFtp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszRemote, uSendAs, pSaveFileOption = NULL)

L_INT LInetFtp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszRemote, uSendAs, pSaveFileOption = NULL)

LBitmapBase pBitmapBase; | /* an LBitmapBase object pointer */
pBITMAPHANDLE pBitmap; | /* pointer to a bitmap handle */
L_INT nFormat; | /* output file format */
L_INT nBitsPerPixel; | /* resulting file's pixel depth */
L_INT nQFactor; | /* quality factor */
L_TCHAR L_FAR *pszRemote; | /* name of the file to be created on the FTP server */
L_UINT uSendAs; | /* flag */
pSAVEFILEOPTION pSaveFileOption; | /* pointer to extended save options */

Saves a bitmap to an FTP server. The output can be in any of the supported, compressed or uncompressed, file formats.

Parameter | Description
pBitmapBase | LBitmapBase class object pointer referencing the bitmap to send.
pBitmap | Pointer to the bitmap handle referencing the bitmap that holds the image data.
nFormat | Output file format. For valid values, refer to Formats of Output Files .
nBitsPerPixel | Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the pBitmap->BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the pBitmap->BitsPerPixel is 2, the file will be stored as 4 bit.
nQFactor | This parameter is used when saving an image file to FILE_CMP, FILE_JFIF, FILE_LEAD1JFIF, FILE_LEAD2JFIF, FILE_JTIF, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process. For possible values, refer to Compression Quality Factors .
pszRemote | Character string that contains the name of the file to create on the remote system. This is a NULL-terminated string.
uSendAs | Flag that indicates the conditions under which the transfers occur. Possible values are:
 | Value | Meaning
 | SENDAS_ASCII | Transfers the file as ASCII
 | SENDAS_BINARY | Transfers the file as BINARY
pSaveOptions | Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Saves a bitmap to the specified FTP server.

If the file specified in pszRemote already exists, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::SendFile, Class Members
Topics: | FTP Functions: Sending Bitmaps
 | How to Program with the LInetFtp Class

Example

/*The following sample is for LInetFtp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszRemote, uSendAs, pSaveFileOption = NULL)*/

// This sample sends a bitmap to the FTP server

L_VOID TestFunction(HWND hWndParent, LBitmapBase BitmapBase)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.SendBitmap(&BitmapBase,
 FILE_CMP, 200, TEXT("Image1.cmp"), SENDAS_BINARY) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 send a bitmap "));
return;
}
}

//---------------------------------------------------------------------------------------------------------------

/*The following sample is for LInetFtp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszRemote, uSendAs, pSaveFileOption = NULL)*/

// This sample also sends a bitmap to the FTP server

L_VOID TestFunction(HWND hWndParent, pBITMAPHANDLE pBitmap)
{
LInetFtp InetFtp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetFtp. GetErrorFromList

 () != SUCCESS)
{
InetFtp. DisplayError  (hWndParent, TEXT("Can't
 connect to the FTP server"));
return;
}

if(InetFtp.SendBitmap(pBitmap,
 FILE_CMP, 24, 200, TEXT("Image2.cmp"), SENDAS_BINARY) != SUCCESS)
{
InetFtp.DisplayError(hWndParent, TEXT("Can't
 send a bitmap "));
return;
}
}


LInetFtp::SendFile

#include "ltwrappr.h"

L_INT LInetFtp::SendFile(pszLocal, pszRemote, uSendAs)

L_TCHAR L_FAR *pszLocal; | /* name of the file to send */
L_TCHAR L_FAR *pszRemote; | /* name of the file to create on the FTP server */
L_UINT uSendAs; | /* flag that indicates the conditions under which the transfers occur */

Sends a file on the local system to the FTP server for storage.

Parameter | Description
pszLocal | Character string that contains the name of the file to send from the local system. This is a NULL-terminated string.
pszRemote | Character string that contains the name of the file to create on the FTP server.
uSendAs | Flag that indicates the conditions under which the transfers occur. Possible values are:
 | Value | Meaning
 | SENDAS_ASCII | Transfers the file as ASCII
 | SENDAS_BINARY | Transfers the file as BINARY

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Stores a file on the FTP server.

If the file specified in pszRemote already exists, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetFtp::GetFile, LInetFtp::RenameFile, LInetFtp::DeleteFile, Class Members
Topics: | FTP Functions: Remote File Operations
 | How to Program with the LInetFtp Class

Example

For an example, refer to LInetFtp::LInetFtp.


LInetHttp::LInetHttp

#include "ltwrappr.h"

L_VOID LInetHttp::LInetHttp(L_VOID)

L_VOID LInetHttp::LInetHttp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 80)

L_TCHAR L_FAR *pszServer; | /* name of server to connect to */
L_TCHAR L_FAR *pszUserName; | /* username for authentication */
L_TCHAR L_FAR *pszPassword; | /* password for authentication */
L_INT nPort; | /* port number to connect to */

Constructs and initializes the member variables of the LInetHttp object.

Parameter | Description
pszServer | Character string that contains the name of the server to which to connect. The name can be a network name, an IP address, or a domain name (www.leadtools.com).
pszUserName | Character string containing the username to be used for authentication. Default value is NULL.
pszPassword | Character string containing the password to be used for authentication. Default value is NULL.
nPort | Number of the port to which to connect. The default port assignment for web servers is 80.

Returns

None

Comments

LInetHttp::LInetHttp() is the default LInetHttp constructor. After calling the this constructor, a user must call LInetHttp::Connect to establish a connection before using other functions.

LInetHttp::LInetHttp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 80) is a constructor for the LInetHttp object. It connects to the HTTP server. If both pszUserName and pszPassword are NULL, the connection is made anonymously.

A connection to an HTTP server must be established before using any other HTTP functions. If a connection is disconnected, via either LInetHttp::Disconnect or LInetHttp::~LInetHttp, then a connection must be re-established before any other HTTP functions are called. LInetHttp::Connect and LInetHttp::LInetHttp can be used to establish a connection with an HTTP server.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::~LInetHttp, LInetHttp::Connect,
Topics: | HTTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetHttp Class

Example

//This example for LInetHttp::LInetHttp(L_VOID)

// This will call the default constructor
 and destructor when it is out of scope

LInetHttp InetHttp();
// other code

//-----------------------------------------------------------------------------------------------------------------------
/*This example for LInetHttp::LInetHttp(pszServer,
 pszUserName = NULL, pszPassword = NULL, nPort = 21)*/

// This example simulates posting a form to a web site

L_VOID TestFunction(HWND hWndParent)
{
L_UINT uStatus;
FILE *pFILE;
NAMEVALUE nv[2];
LBuffer Response;
L_UINT ulSize;

nv[0].pszName = TEXT("email");
nv[0].pszValue = TEXT("support@leadtools.com");
nv[1].pszName = TEXT("name");
nv[1].pszValue = TEXT("First Last");

LInetHttp InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/form.asp")) != SUCCESS)
{
InetHttp.DisplayError (hWndParent,
 TEXT("Can't open a request"));
return;
}

if(InetHttp.SendForm
 (nv, 2) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Error
 while send the form"));
return;
}

uStatus = InetHttp.GetServerStatus
 ();

// Checking if the an error occurred
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 get the server status, the connection may refused"));

InetHttp.GetResponse
 (&Response);
ulSize = Response.GetSize();

#ifdef UNICODE

pFILE = _wfopen(TEXT("error.htm"),TEXT("wb"));
#else

pFILE = fopen("error.htm","wb");
#endif

      while(ulSize != 0)
{
fwrite(Response. Lock

 (), ulSize, 1, pFILE);
Response. Unlock
 ();

InetHttp.GetResponse(&Response);
ulSize = Response. GetSize

 ();
}
fclose(pFILE);

return;
}

   if(uStatus == L_HTTP_STATUS_OK)
{

if(InetHttp.GetResponse
 (&Response) != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 get the server reponse, the connection may refused"));
return;
}

ulSize = Response.GetSize();

#ifdef UNICODE

pFILE = _wfopen(TEXT("output.htm"),TEXT("wb"));
#else

pFILE = fopen("output.htm","wb");
#endif

while(ulSize != 0)
{
fwrite(Response.Lock(), ulSize, 1, pFILE);
InetHttp.GetResponse(&Response);
ulSize = Response. GetSize ();
}
fclose(pFILE);
}
}

Here is a sample form.asp that can be used with this sample.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<BODY>
<table>
<tr>
<td>Email:</td>
<td><% Response.Write Request("Email")%></td>
</tr>
<tr>
<td>Name:</td>
<td><% Response.Write Request("Name")%></td>
</tr>
</table>
</BODY>
<HTML>


LInetHttp::~LInetHttp

#include "ltwrappr.h"

virtual L_VOID LInetHttp::~LInetHttp(L_VOID)

Destroys the object and frees any resources associated with it.

Returns

None

Comments

This is the destructor for the LInetHttp class. It destroys the class object, closes any open requests and disconnects the connection with the HTTP server.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::LInetHttp, Class Members
Topics: | HTTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::LInetHttp.


LInetHttp::CloseRequest

#include "ltwrappr.h"

L_VOID LInetHttp::CloseRequest()

Closes an HTTP request that was opened with LInetHttp::OpenRequest.

Returns

None

Comments

This function should be called after finishing a request.

An open request will also be closed when LInetHttp::Disconnect is called.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::Disconnect, LInetHttp::OpenRequest, Class Members
Topics: | HTTP Functions: Open / Close Requests
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::Connect.


LInetHttp::Connect

#include "ltwrappr.h"

L_INT LInetHttp::Connect(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 80)

L_TCHAR L_FAR *pszServer; | /* name of server to connect to */
L_TCHAR L_FAR *pszUserName; | /* username for authentication */
L_TCHAR L_FAR *pszPassword; | /* password for authentication */
L_INT nPort; | /* port number to connect to */

Connects to an HTTP server.

Parameter | Description
pszServer | Character string that contains the name of the server to which to connect. The name can be a network name, an IP address, or a domain name (www.leadtools.com).
pszUserName | Character string that contains the name of the user logging on. Default value is NULL. This is a NULL-terminated string.
pszPassword | Character string that contains the password to use when logging on. If both pszPassword and pszUsername are NULL, the connection is made anonymously.
nPort | Number of the port to which to connect. The default port assignment for web servers is 80.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to establish a connection with an HTTP Server. To connect anonymously pass NULL for pszUserName and pszPassword.

A connection to an HTTP server must be established before using any other HTTP functions. If a connection is disconnected, via either LInetHttp::Disconnect or LInetHttp::~LInetHttp, then a connection must be re-established before any other HTTP functions are called. LInetHttp::Connect and LInetHttp::LInetHttp can be used to establish a connection with an HTTP server.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::LInetHttp, LInetHttp::Disconnect, LInetHttp::OpenRequest, LInetHttp::CloseRequest, LInetHttp::SendBitmap, LInetHttp::SendData, LInetHttp::SendForm, LInetHttp::SendRequest, LInetHttp::GetResponse, LInetHttp::GetServerStatus, Class Members
Topics: | HTTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetHttp Class

Example

L_VOID TestConnect(HWND hWndParent)
{
LInetHttp InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/default.htm")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}

// Another code

   InetHttp.CloseRequest
 ();
InetHttp.Disconnect
 ();

if(InetHttp.Connect(TEXT("www.leadtools.com"),
 TEXT("ABC"), TEXT("XYZ")) != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server, user-name or password may invalid!!"));
return;
}
}


LInetHttp::Disconnect

#include "ltwrappr.h"

L_VOID LInetHttp::Disconnect(L_VOID)

Disconnects a connection with an HTTP server.

Returns

None

Comments

Calling this function also closes any open request.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::LInetHttp, LInetHttp::Connect, Class Members
Topics: | HTTP Functions: Connect / Disconnect Operations
 | How to Program with the LInetHttp Class

Example

For an example refer to LInetHttp::Connect.


LInetHttp::GetResponse

#include "ltwrappr.h"

L_INT LInetHttp::GetResponse(pData)

LBuffer *pData;

/* pointer to an LBuffer object */

Retrieves a response from an HTTP server.

Parameter | Description
pData | Pointer to an LBuffer class object referencing the response data to retrieve.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The response information should be read after submitting a request to an HTTP server.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::GetServerStatus, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::LInetHttp.


LInetHttp::GetServerStatus

#include "ltwrappr.h"

L_UINT LInetHttp::GetServerStatus(L_VOID)

Retrieves the status of the last request sent to the HTTP server.

Returns

The status of the last request. For a list of possible values, refer to HTTP Server Request/Connection Status.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::GetResponse, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::LInetHttp.


LInetHttp::OpenRequest

#include "ltwrappr.h"

L_INT LInetHttp::OpenRequest(uType, pszTarget, dwFlags = 0, pszReferer = NULL, pszVersion = NULL)

L_UINT uType; | /* type of request */
L_TCHAR L_FAR *pszTarget; | /* the target of the request */
L_UINT dwFlags; | /* request flags */
L_TCHAR L_FAR *pszReferer; | /* address of URL that initiated the request */
L_TCHAR L_FAR *pszVersion; | /* HTTP version */

Creates a new HTTP request to be sent to the server.

Parameter | Description
uType | Specifies the type of request. Possible values are:
 | Value | Meaning
 | HTTP_GET | Send an HTTP-GET Request
 | HTTP_POST | Send an HTTP-PUT Request
pszTarget | Character string that contains the name of the file, executable module or search specifier to get or post.
pszReferer | Character string that contains the name of the document on which the link is found.
pszVersion | Character string that contains the HTTP version. If this parameter is NULL, "HTTP/1.0" is used.
dwFlags | Reserved for future use. Use 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

An HTTP request holds a request to be sent to an HTTP server and contains
 all RFC822/MIME/HTTP headers to be sent as part of the request. LInetHttp::OpenRequest must be called
 before calling the following functions LInetHttp::SendBitmap,
 LInetHttp::SendData, LInetHttp::SendForm and
 LInetHttp::SendRequest.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::LInetHttp, LInetHttp::Disconnect, LInetHttp::CloseRequest, LInetHttp::SendBitmap, LInetHttp::SendData, LInetHttp::SendForm, LInetHttp::SendRequest, LInetHttp::GetResponse, LInetHttp::GetServerStatus, Class Members
Topics: | HTTP Functions: Open / Close Requests
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::LInetHttp.


LInetHttp::SendBitmap

#include "ltwrappr.h"

L_INT LInetHttp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)

L_INT LInetHttp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)

LBitmapBase *pBitmapBase; | /* pointer to an LBitmapBase object */
pBITMAPHANDLE pBitmap; | /* pointer to a bitmap handle */
L_INT nFormat; | /* output file format */
L_INT nBitsPerPixel; | /* output bits per pixel */
L_INT nQFactor; | /* quality factor */
L_TCHAR L_FAR *pszContentType; | /* HTTP content type */
pNAMEVALUE pNameValue; | /* pointer to a structure */
pSAVEFILEOPTION pSaveFileOption; | /* pointer to extended save options */

Sends a bitmap to an HTTP server.

Parameter | Description
pBitmapBase | Pointer to an LBitmapBase classes object referencing the bitmap to send.
pBitmap | Pointer to the bitmap handle referencing the bitmap to send. The bitmap handle can contain the actual data, but does not have to, since your callback function can supply the data. However, the bitmap handle must contain values for the following fields: Width, Height, BitsPerPixel, BytesPerLine, nColors, ViewPerspective, Order, and DitheringMethod. (The BytesPerLine value must be a multiple of four.)
nFormat | Output file format. For valid values, refer to Formats of Output Files .
nBitsPerPixel | Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the pBitmap->BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the pBitmap->BitsPerPixel is 2, the file will be stored as 4 bit.
nQFactor | This parameter is used when saving an image file to FILE_CMP, FILE_JFIF, FILE_LEAD1JFIF, FILE_LEAD2JFIF, FILE_JTIF, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process. For possible values, refer to Compression Quality Factors .
pszContentType | A string describing the content type. This string is usually formatted type/subtype where type is the general content category and subtype is the specific content type. For a full list of supported content types, see your Web browser documentation or the current HTTP specification.
pNameValue | A pointer to the structure that contains the name/value pair for this image. This information is used to get the information from a script on the server machine. This name is usually some user-defined name and the value is the filename of the image.
pSaveOptions | Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

It is up to a script on the server side to process the data when it is received. This script is specified in the LInetHttp::OpenRequest function. The script can be any type of file that is recognized by the HTTP Server.

This function actually saves a LEADTOOLS bitmap to a file in memory, and then sends the resulting memory file to an HTTP server.

Note: The LEADTOOLS Uploading Component can be used in an ASP page to extract the uploaded data.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::OpenRequest, LInetHttp::SendData, LInetHttp::SendForm, LInetHttp::SendReques t, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

/*The following sample is for LInetHttp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)*/

// This sample sends a bitmap to the HTTP web server

L_VOID TestSendBitmap(LBitmapBase Bitmap, HWND hWndParent)
{
NAMEVALUE nv;
LInetHttp   InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/upload.asp")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}
nv.pszName = TEXT("Photo");
nv.pszValue = TEXT("photo1.jpg");

if(InetHttp.SendBitmap
 (&Bitmap, FILE_JFIF, 200, TEXT("image/jpg"), &nv) !=
 SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 send an image, an error may occurred"));
return;
}
}

//---------------------------------------------------------------------------------------------------------------

/*The following sample is for LInetHttp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)*/

// This sample also sends a bitmap to the HTTP web server

L_VOID TestSendBitmap(pBITMAPHANDLE pBitmap, HWND hWndParent)
{
NAMEVALUE nv;
LInetHttp   InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/upload.asp")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}
nv.pszName = TEXT("Photo");
nv.pszValue = TEXT("photo1.jpg");

if(InetHttp.SendBitmap(pBitmap,
 FILE_JFIF, 24, 200, TEXT("image/jpg"), &nv) != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 send an image, an error may occurred"));
return;
}
}

The following upload.asp page can be used to get access to the upload file. Upload.asp also makes use of the LEAD Upload control.

<%
Set Upload = Server.CreateObject("LEAD.Upload")
Lead.EnableMethodErrors = false

set files = Upload.Upload

Upload.Save "c:\inetpub\wwwroot\"

' Process all files received
For Each File in Files
Response.Write File.Name & " = " & File.FileName & "<BR>"
Response.Write "Size = " & File.Size & "<BR>"
Response.Write "<BR><BR>"
Next
%>


LInetHttp::SendData

#include "ltwrappr.h"

L_INT LInetHttp::SendData(pData, pszContentType, pNameValue)

L_INT LInetHttp::SendData(pszData, uSize, pszContentType, pNameValue)

LBuffer *pData; | /* pointer to an LBuffer object */
L_CHAR L_FAR *pszData; | /* pointer to the data to send */
L_UINT32 uSize; | /* size of pszData */
L_TCHAR L_FAR *pszContentType; | /* HTTP content type */
pNAMEVALUE pNameValue; | /* pointer to a structure */

Sends raw data to an HTTP server.

Parameter | Description
pData | Pointer to an LBuffer classes object referencing the data to send.
pszData | Pointer to data to send in the HTTP request.
uSize | Size of pszData.
pszContentType | A string describing the content type. This string is usually formatted type/subtype where type is the general content category and subtype is the specific content type. For a full list of supported content types, see your Web browser documentation or the current HTTP specification.
pNameValue | A pointer to the structure that contains the name/value pair for this image. This information is used to get the information from a script on the server machine. This name is usually some user-defined name and the value is the filename of the data.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

It is up to a script on the server side to process the data when it is received. This script is specified in the LInetHttp::OpenRequest function. The script can be any type of file that is recognized by the HTTP Server.

Note: The LEADTOOLS Uploading Component can be used in an ASP page to extract the uploaded data.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::OpenRequest, LInetHttp::SendBitmap, LInetHttp::SendForm, LInetHttp::SendRequest, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

The upload.asp file for the LInetHttp::SendBitmap function can also be used with these samples.

/*The following sample is for LInetHttp::SendData(pData, pszContentType, pNameValue)*/

// This sample sends raw data to the HTTP web server

L_VOID TestSendData(LBuffer Data, HWND hWndParent)
{
NAMEVALUE nv;
LInetHttp   InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest(HTTP_POST,
 TEXT("/upload.asp")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}
nv.pszName = TEXT("Data");
nv.pszValue = TEXT("data1.raw");

if(InetHttp.SendData
 (&Data, TEXT("image/jpg"), &nv) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 send an image, an error may occurred"));
return;
}
}

//---------------------------------------------------------------------------------------------------------------

/*The following sample is for LInetHttp::SendData(pszData, uSize, pszContentType, pNameValue)*/

// This sample also sends raw data to the HTTP web server

L_VOID TestSendData(L_CHAR L_FAR *pszData, L_UINT32 ulSize,
 HWND hWndParent)
{
NAMEVALUE nv;
LInetHttp   InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/upload.asp")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}
nv.pszName = TEXT("Data");
nv.pszValue = TEXT("data1.raw");

if(InetHttp.SendData(pszData,
 ulSize, TEXT("image/jpg"), &nv) != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 send an image, an error may occurred"));
return;
}
}


LInetHttp::SendForm

#include "ltwrappr.h"

L_INT LInetHttp::SendForm(pNameValue, uCount)

pNAMEVALUE pNameValue; | /* pointer to a structure */
L_UINT32 uCount; | /* number of name/value pairs */

Sends a form to an HTTP server.

Parameter | Description
pNameValue | Pointer to an array of structures that contain the name and value pairs associated with the form. This information corresponds to the name and value you would provide if programming in HTML.
uCount | The number of name/value pairs.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function allows you to simulate submitting a form to an Internet browser. You do not need an Internet browser to use this function.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::OpenRequest, LInetHttp::SendBitmap, LInetHttp::SendData, LInetHttp::SendRequest, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

For an example, refer to LInetHttp::LInetHttp.


LInetHttp::SendRequest

#include "ltwrappr.h"

L_INT LInetHttp::SendRequest(pszHeader, ulHeaderSize, pszOptional, ulOptionalSize)

L_TCHAR L_FAR *pszHeader; | /* pointer to header data */
L_UINT32 ulHeaderSize; | /* sizeof the header data */
L_TCHAR L_FAR *pszOptional; | /* optional data */
L_UINT32 ulOptionalSize; | /* sizeof the optional data */

Sends an HTTP request to the HTTP server.

Parameter | Description
pszHeader | Pointer to any additional header data to be sent along with the request. This parameter can be NULL if there are no additional headers to append.
ulHeaderSize | Size of the data in pszHeader.
pszOptional | Pointer to any optional data to be sent after the HTTP header. This parameter is generally used for POST and PUT operations. The optional data can be the resource or information being posted to the server. This parameter can be NULL if there is no optional data to send.
ulOptionalSize | Size of the data in pszOptional.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | LInetHttp::OpenRequest, LInetHttp::SendBitmap, LInetHttp::SendData, LInetHttp::SendForm, Class Members
Topics: | HTTP Functions: Sending / Getting Data
 | How to Program with the LInetHttp Class

Example

// This sample sends a request to the HTTP web server

L_VOID TestSendRequest(HWND hWndParent)
{
LInetHttp   InetHttp(TEXT("www.leadtools.com"));

// Checking if the connection failed
if(InetHttp. GetErrorFromList

 () != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 connect to the HTTP web server"));
return;
}

if(InetHttp.OpenRequest
 (HTTP_POST, TEXT("/default.htm")) != SUCCESS)
{
InetHttp.DisplayError(hWndParent, TEXT("Can't
 open a request"));
return;
}

if(InetHttp.SendRequest(NULL,
 0, NULL, 0) != SUCCESS)
{
InetHttp. DisplayError  (hWndParent, TEXT("Can't
 send a request, an error may occurred"));
return;
}
}


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling LSettings::UnlockSupport (L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling LSettings::UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the ..

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


HTTP Server Request/Connection Status

The following are possible values returned by the LInetHttp::GetServerStatus.

Value | Meaning
L_HTTP_STATUS_OK | [0x00C8] request completed
L_HTTP_STATUS_CREATED | [0x00C9] object created, reason = new URI
L_HTTP_STATUS_ACCEPTED | [0x00CA] asynchronous completion (TBS)
L_HTTP_STATUS_PARTIAL | [0x00CB] partial completion
L_HTTP_STATUS_NO_CONTENT | [0x00CC] no info to return
L_HTTP_STATUS_RESET_CONTENT | [0x00CD] request completed, but clear form
L_HTTP_STATUS_PARTIAL_CONTENT | [0x00CE] partial GET fulfilled
L_HTTP_STATUS_AMBIGUOUS | [0x012C] server couldn't decide what to return
L_HTTP_STATUS_MOVED | [0x012D] object permanently moved
L_HTTP_STATUS_REDIRECT | [0x012E] object temporarily moved
L_HTTP_STATUS_REDIRECT_METHOD | [0x012F] redirection w/ new access method
L_HTTP_STATUS_NOT_MODIFIED | [0x0130] requested resource has not been modified
L_HTTP_STATUS_USE_PROXY | [0x0131] redirection to proxy, location header specifies proxy to use.
L_HTTP_STATUS_REDIRECT_KEEP_VERB | [0x0133] HTTP/1.1: keep same verb
L_HTTP_STATUS_BAD_REQUEST | [0x0190] invalid syntax
L_HTTP_STATUS_DENIED | [0x0191] access denied
L_HTTP_STATUS_PAYMENT_REQ | [0x0192] payment required
L_HTTP_STATUS_FORBIDDEN | [0x0193] request forbidden
L_HTTP_STATUS_NOT_FOUND | [0x0194] object not found
L_HTTP_STATUS_BAD_METHOD | [0x0195] method is not allowed
L_HTTP_STATUS_NONE_ACCEPTABLE | [0x0196] no response acceptable to client found
L_HTTP_STATUS_PROXY_AUTH_REQ | [0x0197] proxy authentication required
L_HTTP_STATUS_REQUEST_TIMEOUT | [0x0198] server timed out waiting for request
L_HTTP_STATUS_CONFLICT | [0x0199] user should resubmit with more info
L_HTTP_STATUS_GONE | [0x019A] the resource is no longer available
L_HTTP_STATUS_LENGTH_REQUIRED | [0x019B] the server refused to accept request w/o a length
L_HTTP_STATUS_PRECOND_FAILED | [0x019C] precondition given in request failed
L_HTTP_STATUS_REQUEST_TOO_LARGE | [0x019D] request entity was too large
L_HTTP_STATUS_URI_TOO_LONG | [0x019E] request URI too long
L_HTTP_STATUS_UNSUPPORTED_MEDIA | [0x019F] unsupported media type
L_HTTP_STATUS_SERVER_ERROR | [0x01F4] internal server error
L_HTTP_STATUS_NOT_SUPPORTED | [0x01F5] server does not support the functionality required to fulfill the request
L_HTTP_STATUS_BAD_GATEWAY | [0x01F6] error response received from gateway
L_HTTP_STATUS_SERVICE_UNAVAIL | [0x01F7] temporarily overloaded
L_HTTP_STATUS_GATEWAY_TIMEOUT | [0x01F8] timed out waiting for gateway
L_HTTP_STATUS_VERSION_NOT_SUP | [0x01F9] HTTP version not supported


Uploading Component

An upload component is also included in this package. This component allows the programmer of ASP pages to receive files uploaded to the web server. This component not only works with the LInetHttp class functions, but also supports uploading from any browser that supports the following HTML form attribute: enctype=multipart/form-data.


Topic Selection

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.