LFile::WriteComment

#include "ltwrappr.h"

virtual L_INT LFile::WriteComment(uType, pComments, pSaveFileOption=NULL)

L_UINT uType;

/* type of comment */

LPFILECOMMENTS pComments;

/* pointer to a structure */

pSAVEFILEOPTION pSaveFileOption;

/* pointer to optional extended save options */

Writes a comment into a FlashPix file. Only used to change a comment in an existing file.

Parameter

Description

uType

The type of comment. Refer to Types of File Comments. For more information concerning FlashPix file comments, see FlashPix File Comments.

pComments

Pointer to a structure which contains one data value and two pointers. The data value indicates the number of comments stored. One pointer points to an array of pointers which in turn point to individual Comments. The other pointer points to an array of integers which indicate the size of each Comment stored.

pSaveFileOption

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

Presently this function only works with FlashPix format files.

To write comments to a file, all the comments you wish to add to the file must be set using LFileSettings::SetComment. Once all comments are set, the comments are saved using any function which saves files, such as LFile::SaveFile or LFile::SaveBitmap when creating a new file, or LFile::WriteComment when changing a comment in an existing file. LFileSettings::SetComment, by itself, does not write a comment to a file, it prepares the values for the next save.

When you add or remove comments or tags, the comments and tags array at the end of the image file is re-written. When you modify existing comments or tags, the new value is added to the file and the IFD is modified as necessary. In all of these cases, there is no image recompression.

Required DLLs and Libraries

LTFIL
File format DLLs

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:

Class Members

Topics:

Raster Image Functions: Maintaining File Comments

 

Loading and Saving Images

Example

LFile file;
FILECOMMENTS FileComments;
L_UCHAR L_FAR *pPointer[CMNT_LAST + 1];
L_UINT uSize[CMNT_LAST + 1];
FPXCOMMENT_HEADER_ELEMENT L_FAR *pElement;
L_UINT16 L_FAR  *pShort;
L_FLOAT L_FAR *pFloat;
L_UINT  i;
L_UCHAR Buffer[1024];
FileComments.count = CMNT_LAST + 1;
FileComments.pointer = pPointer;
FileComments.size = uSize;
for ( i = 0; i < CMNT_LAST; i++)
{
   uSize[i] = 0;
   pPointer[i] = NULL;
}
pElement = (FPXCOMMENT_HEADER_ELEMENT L_FAR *) Buffer;
pElement->size = sizeof(FPXCOMMENT_HEADER_ELEMENT) + sizeof(L_FLOAT);
pElement->type = FPXENUM_FLOAT;
pFloat = (L_FLOAT L_FAR *)(pElement + 1);
*pFloat = 12.34f;

uSize[CMNT_FPXFILMSIZEX] = pElement->size;
pPointer[CMNT_FPXFILMSIZEX] = (L_UCHAR L_FAR *)pElement;
pElement = (FPXCOMMENT_HEADER_ELEMENT L_FAR *)(pFloat + 1);
pElement->size = sizeof(FPXCOMMENT_HEADER_ELEMENT) + sizeof(L_UINT16);
pElement->type = FPXENUM_SHORT;
pShort = (L_UINT16 L_FAR *)(pElement + 1);
*pShort = 1234;
uSize[CMNT_FPXFILMFRAMENUMBER] = pElement->size;
pPointer[CMNT_FPXFILMFRAMENUMBER] = (L_UCHAR L_FAR *)pElement;
file.SetFileName(TEXT("TEST.FPX"));
file.WriteComment(CMNT_FPXFILMDESCRIPTIONGROUP, &FileComments, NULL);