AnnDeletePageMemory Example for Visual C++
//This sample saves the annotations as the first page of a multipage annotation file in memory
//The annotations are flipped, and saved as the second page
//The annotations are 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
int nRet;
CString strFormat;
CString strMsg;
long lSize, nHandle;
//Save as the first page of the annotation file
nHandle = 0;
m_pRasterAnn->AnnSaveMemory (&nHandle, ANN_FMT_NATIVE, FALSE, &lSize, SAVE_OVERWRITE, 0);
//Flip the container, and save as the second page (insert before page 2)
m_pRasterAnn->AnnFlip (TRUE, m_RasterView1.GetRaster().GetBitmapHeight() / 2, FALSE);
m_pRasterAnn->AnnSaveMemory (&nHandle, ANN_FMT_NATIVE, FALSE, &lSize, SAVE_INSERT, 2);
//Rotate the container, and save as the third page
//Here we could pass the SAVE_INSERT flag and 3 for nPage,
//but instead we will use the SAVE_APPEND flag
m_pRasterAnn->AnnRotate (FALSE, m_RasterView1.GetRaster ().GetBitmapWidth () / 2, m_RasterView1.GetRaster ().GetBitmapHeight () / 2, 45, FALSE);
m_pRasterAnn->AnnSaveMemory (&nHandle, ANN_FMT_NATIVE, FALSE, &lSize, SAVE_APPEND, 0);
//Verify contents of file
nRet = m_pRasterAnn->AnnFileInfoMemory ((long)nHandle, lSize);
if (nRet == 0)
{
switch (m_pRasterAnn->GetAnnInfoFormat ())
{
case ANN_FMT_NATIVE:
strFormat = TEXT("ANN_FMT_NATIVE");
break;
case ANN_FMT_WMF:
strFormat = TEXT("ANN_FMT_WMF");
break;
case ANN_FMT_ENCODED:
strFormat = TEXT("ANN_FMT_ENCODED");
break;
default:
strFormat = TEXT("Unknown");
break;
}
strMsg.Format(TEXT("Format: %s\nVersion: %d\nTotal Pages: %d\nTotal Size: %d\n"),
strFormat,
m_pRasterAnn->GetAnnInfoVersion (),
m_pRasterAnn->GetAnnInfoTotalPages (),
lSize);
MessageBox(strMsg);
}
else
{
MessageBox(TEXT("Invalid Annotation Memory File"));
}
//Now delete the second page, and display information
m_pRasterAnn->AnnDeletePageMemory ((long)nHandle, 2);
lSize = m_pRasterAnn->GetAnnPageMemorySize();
//Verify contents of file
nRet = m_pRasterAnn->AnnFileInfoMemory ((long)nHandle, lSize);
if (nRet == 0)
{
switch (m_pRasterAnn->GetAnnInfoFormat ())
{
case ANN_FMT_NATIVE:
strFormat = TEXT("ANN_FMT_NATIVE");
break;
case ANN_FMT_WMF:
strFormat = TEXT("ANN_FMT_WMF");
break;
case ANN_FMT_ENCODED:
strFormat = TEXT("ANN_FMT_ENCODED");
break;
default:
strFormat = TEXT("Unknown");
break;
}
strMsg.Format(TEXT("Format: %s\nVersion: %d\nTotal Pages: %d\nTotal Size: %d\n"),
strFormat,
m_pRasterAnn->GetAnnInfoVersion (),
m_pRasterAnn->GetAnnInfoTotalPages (),
lSize);
MessageBox(strMsg);
}
else
{
MessageBox(TEXT("Invalid Annotation Memory File"));
}