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 *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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
/*The following sample is for LInetFtp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszRemote, uSendAs, pSaveFileOption = NULL)*/
// This sample sends a bitmap to the FTP server
L_INT LInetFtp_SendBitmapExample_1(HWND hWndParent, LBitmapBase BitmapBase)
{
   L_INT nRet;
   LInetFtp InetFtp(TEXT("www.leadtools.com"));
   // Checking if the connection failed
   nRet = InetFtp.GetErrorFromList ();
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server"));
      return nRet;
   }
   nRet = InetFtp.SendBitmap(&BitmapBase, FILE_CMP, 200, TEXT("Image1.cmp"), SENDAS_BINARY);
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError(hWndParent, TEXT("Can't send a bitmap "));
      return nRet;
   }
   return SUCCESS;
}
//---------------------------------------------------------------------------------------------------------------
/*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_INT LInetFtp_SendBitmapExample_2(HWND hWndParent, pBITMAPHANDLE pBitmap)
{
   L_INT nRet;
   LInetFtp InetFtp(TEXT("www.leadtools.com"));
   // Checking if the connection failed
   nRet = InetFtp.GetErrorFromList ();
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server"));
      return nRet;
   }
   nRet = InetFtp.SendBitmap(pBitmap, FILE_CMP, 24, 200,MAKE_IMAGE_PATH(TEXT("Image2.cmp")), SENDAS_BINARY);
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError(hWndParent, TEXT("Can't send a bitmap "));
      return nRet;
   }
   return SUCCESS;
}