SkipFile example for C++ 5.0 and later
void CRasterThumbnailSink::OnThumbnailEvent(long Bitmap, TCHAR * pszFilename, short StatusCode, short nPercent)
{
CString csOut;
CString cs;
//in this example, nCount is a global variable used to count the thumbnails
switch(StatusCode)
{
case 0: //successful thumbnail generation
//save thumbnails in a multipage TIFF file
nCount++;
if(nCount > 20) //allow max of 20 thumbnails
{
m_pDlg->m_pRasterThumbnail->PutContinueBrowse (FALSE); //stop the browse
return;
}
csOut.Format(TEXT("%s\nFormat: %d\nCompression: %d\nBits: %d\nWidth: %d\nHeight: %d\nPage: %d\nTotalPages: %d\nSizeDisk: %ld\nSizeMem: %ld\nXRes: %d\nYRes: %d"),
pszFilename,
m_pDlg->m_pRasterThumbnail->GetInfoFormat(),
m_pDlg->m_pRasterThumbnail->GetInfoCompression(),
m_pDlg->m_pRasterThumbnail->GetInfoBits (),
m_pDlg->m_pRasterThumbnail->GetInfoWidth(),
m_pDlg->m_pRasterThumbnail->GetInfoHeight(),
m_pDlg->m_pRasterThumbnail->GetInfoPage (),
m_pDlg->m_pRasterThumbnail->GetInfoTotalPages (),
m_pDlg->m_pRasterThumbnail->GetInfoSizeDisk (),
m_pDlg->m_pRasterThumbnail->GetInfoSizeMem (),
m_pDlg->m_pRasterThumbnail->GetInfoXRes (),
m_pDlg->m_pRasterThumbnail->GetInfoYRes ());
AfxMessageBox(csOut);
break;
case BROWSE_PRELOAD:
csOut = pszFilename;
cs = pszFilename;
cs = cs.Right(4);
//check the extension, if it is ".DOC", then skip
if(!cs.CompareNoCase(TEXT(".DOC"))
{
m_pDlg->m_pRasterThumbnail->PutSkipFile(TRUE);
AfxMessageBox(TEXT("skipping - ") + csOut);
}
break;
}
m_pDlg->m_pRasterThumbnail->PutContinueBrowse (TRUE); //continue the browse operation
}