virtual L_INT LFile::ReadCommentExt(uType, pComments, pBuffer, puLength, pLoadFileOption=NULL)
Gets a single comment, a group of comments or several groups of comments from a file.
The type of comment. Refer to Types of File Comments. A group of comments may be obtained such as CMNT_FPXSUMMARYINFORMATION, or more than one group of comments may be retrieved by using OR as in CMNT_FPXSUMMARYINFORMATION | CMNT_FPXFILESOURCEGROUP, or all comments may be obtained by using CMNT_ALL. See Example listed below. For more information concerning FlashPix file comments, see FlashPix File Comments.
Pointer to a structure which contains a data value indicating the number of comments stored, a pointer to an array of pointers which in turn point to the individual Comments, and a pointer to an array of integers which indicate the size of each Comment stored.
Pointer to the buffer object that will hold all the comments.
Pointer to a variable to be updated with the size of the buffer that will hold all the comments.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Presently this function only works with FlashPix format files.
The basic order of function calls to retrieve comments is as follows:
To write comments to a file, all the comments you wish to add to a new file must be set. LFileSettings::SetComment sets each comment individually, but it does not save the comments to the file, it prepares the values for the next save.. Once all comments are set, the comments are saved using any function which saves files, such as LFile::SaveFile or LFile::Save when creating a new file. If you wish to change a comment in an existing file, use LFile::WriteComment.
Win32, x64.
typedef struct _FPXCOMMENT_HEADER_ELEMENT
{
L_UINT32 size;
L_UINT32 type;
} FPXCOMMENT_HEADER_ELEMENT;
typedef struct _FPXCOMMENT_HEADER_ARRAY
{
L_UINT32 size;
L_UINT32 type;
L_UINT32 elements;
}FPXCOMMENT_HEADER_ARRAY;
L_INT LFile_ReadCommnetExtExample()
{
L_INT nRet = SUCCESS;
L_UINT uLength;
L_TCHAR szMessage[80];
L_CHAR *pTextToGet;
L_UINT32 *pLong;
L_CHAR *pString;
FPXCOMMENT_HEADER_ARRAY *pArray;
FPXCOMMENT_HEADER_ELEMENT *pElement;
FILECOMMENTS FileComments;
L_UCHAR *pPointer [CMNT_LAST + 1];
L_UINT uSize[CMNT_LAST + 1];
/*Read one group of comments:*/
L_INT nStatus;
LFile File;
LBuffer Buff;
/* Determine the size, in bytes, of the desired group of comments. */
File.SetFileName(MAKE_IMAGE_PATH(TEXT("imaage1.FPX")));
nStatus = File.GetCommentSize(CMNT_FPXTITLE, &uLength);
/* Allocate a buffer based on the size of the comments obtained by LFile::GetCommentSize and stored in uLength. */
nRet = Buff.Reallocate(uLength);
if(nRet != SUCCESS)
return nRet;
pTextToGet = (L_CHAR *)Buff.Lock();
/* Initialize the FileComments structure. */
FileComments.count = CMNT_LAST + 1;
FileComments.pointer = pPointer;
FileComments.size = uSize;
/* Read the group of comments into the buffer. */
nStatus = File.ReadCommentExt(CMNT_FPXTITLE,&FileComments,(L_UCHAR *) pTextToGet, &uLength);
/* Extract the desired individual comments from within the group */
pArray = (FPXCOMMENT_HEADER_ARRAY *)pPointer [CMNT_FPXTITLE];
pElement = (FPXCOMMENT_HEADER_ELEMENT *) pPointer [CMNT_FPXSECURITY];
/* Test to be sure the comments exist. If they exist, print them.*/
if((pArray != NULL)&&(pElement != NULL))
{
pString = (L_CHAR*)(pArray + 1);
pLong = (L_UINT32 *)(pElement + 1);
wsprintf(szMessage, TEXT("%hs-%ul"), pString, *pLong);
MessageBox(NULL, szMessage, TEXT("Title & Security"), MB_OK);
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document