L_AnnFileInfoOffset
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_AnnFileInfoOffset(fd, pAnnFileInfo, uStructSize)
L_INT fd; |
/* Windows file handle of the file to load */ |
pANNFILEINFO pAnnFileInfo; |
/* pointer to a structure */ |
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pAnnFileInfo */ |
Loads information about the annotation file embedded in another file, into the specified ANNFILEINFO structure. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
fd |
The Windows file handle of the file. |
pAnnFileInfo |
Pointer to the ANNFILEINFO structure to be updated with the annotation file information. |
uStructSize |
Size in bytes, of the structure pointed to by pAnnFileInfo, for versioning. Use sizeof(ANNFILEINFO). |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function can be used to get information about a LEAD annotation file that is embedded in another file.
To use this function, do the following:
1. |
Open the annotation file to get a Windows file handle. |
2. |
Declare a variable with the datatype of ANNFILEINFO. |
3. |
Fill in the nSize and nOffset fields of the ANNFILEINFO variable. The field nSize should contain the size of the ANNFILEINFO structure in bytes. The nOffset field should contain the byte location of the first byte of the annotation file. |
4. |
Call the L_AnnFileInfoOffset function, passing the Windows file handle, and the address of the ANNFILEINFO variable as parameters. |
5. |
Get the image information from the fields described in ANNFILEINFO structure. |
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Functions: |
L_AnnFileInfo, L_AnnFileInfoMemory, L_AnnLoad, L_AnnLoadMemory, L_AnnLoadOffset, L_AnnSave, L_AnnSaveOffset, L_AnnSaveMemory |
Topics: |
|
|
|
|
|
|
|
|
Example
//This sample saves the annotation container as the first page of a multi-page annotation file
//The format is specified by the 'uFormat' parameter (either ANNFMT_NATIVE or ANNFMT_ENCODED)
//The file is saved starting at 30 bytes into the file
//The container is flipped, and saved as the second page
//The container is rotated, and saved as the third page
//Information is displayed about the annotation file
//The second page is deleted, and information is again displayed about the annotation file
L_INT SampleAnnSaveOffset(L_TCHAR *pszFileName, L_UINT32 uFormat, HANNOBJECT hContainer)
{
HFILE hFile;
int nRet;
SAVEFILEOPTION SaveFileOption;
ANNFILEINFO AnnFileInfo;
L_TCHAR szMsg[200];
L_TCHAR *pszFormat;
L_UINT32 uSizeWritten;
L_UINT32 uOffset = 30;
#ifdef UNICODE
hFile = _wcreat(pszFileName, 0);
#else
hFile = _lcreat(pszFileName, 0);
#endif
_lwrite(hFile, "This is a 29-character string", uOffset);
//Save as the first page of the annotation file
nRet = L_AnnSaveOffset(hFile, uOffset, &uSizeWritten, hContainer, uFormat, FALSE, NULL);
if (nRet != SUCCESS)
return nRet;
//Flip the container, and save as the second page (insert before page 2)
SaveFileOption.uStructSize = sizeof(SAVEFILEOPTION);
SaveFileOption.Flags = ESO_INSERTPAGE;
SaveFileOption.PageNumber = 2;
nRet = L_AnnFlip(hContainer, NULL, ANNFLAG_RECURSE);
if (nRet != SUCCESS)
return nRet;
nRet = L_AnnSaveOffset(hFile, uOffset, &uSizeWritten, hContainer, uFormat, FALSE, &SaveFileOption);
if (nRet != SUCCESS)
return nRet;
//Rotate the container, and save as the third page
nRet = L_AnnRotate(hContainer, 45.0, NULL, ANNFLAG_RECURSE);
if (nRet != SUCCESS)
return nRet;
SaveFileOption.PageNumber = 3;
nRet = L_AnnSaveOffset(hFile, uOffset, &uSizeWritten, hContainer, uFormat, FALSE, &SaveFileOption);
if (nRet != SUCCESS)
return nRet;
//Verify contents of file
AnnFileInfo.uStructSize = sizeof(ANNFILEINFO);
AnnFileInfo.nOffset = uOffset;
nRet = L_AnnFileInfoOffset(hFile, &AnnFileInfo, sizeof(ANNFILEINFO));
if (nRet != SUCCESS)
return nRet;
switch(AnnFileInfo.uFormat)
{
case ANNFMT_NATIVE:
pszFormat = TEXT("ANNFMT_NATIVE");
break;
case ANNFMT_WMF:
pszFormat = TEXT("ANNFMT_WMF");
break;
case ANNFMT_ENCODED:
pszFormat = TEXT("ANNFMT_ENCODED");
break;
default:
pszFormat = TEXT("Unknown");
break;
}
wsprintf(szMsg,
TEXT("File[%s]\nVersion[%d]\nFormat[%s]\nTotal Pages[%d]\n"),
pszFileName,
AnnFileInfo.nVersion,
pszFormat,
AnnFileInfo.nTotalPages);
MessageBox(NULL, szMsg, TEXT("Information"), MB_OK);
//Now delete the second page, and display information
nRet = L_AnnDeletePageOffset(hFile, uOffset, 2);
AnnFileInfo.uStructSize = sizeof(ANNFILEINFO);
nRet = L_AnnFileInfoOffset(hFile, &AnnFileInfo, sizeof(ANNFILEINFO));
if (nRet != SUCCESS)
return nRet;
wsprintf(szMsg,
TEXT("File[%s]\nVersion[%d]\nFormat[%s]\nTotal Pages[%d]\n"),
pszFileName,
AnnFileInfo.nVersion,
pszFormat,
AnnFileInfo.nTotalPages);
MessageBox(NULL, szMsg, TEXT("Information"), MB_OK);
_lclose(hFile);
return nRet;
}