This example shows how you can use the CompressionType, FileType, ImageHeight, ImageResolutionX, ImageResolutionY, ImageWidth and PageCount properties to request information about a file. Attributes for specific page of a specific file will be displayed.
void CAdmin1Dlg::OnGetimageinfo()
{
// Load the form where we will display file attributes.
CFrmInfo frmInfo;
CString strImgFileType, strImgCompType, strImgPageType;
// Must specify page number if other than page 1
ImgAdmin1.SetPageNumber(2);
// Read the Filetype property and translate the value to
// a corresponding string.
switch (ImgAdmin1.GetFileType())
{
case 0:
strImgFileType = "Unknown";
break;
case 1:
strImgFileType = "TIF";
break;
case 2:
strImgFileType = "AWD";
break;
case 3:
strImgFileType = "BMP";
break;
case 4:
strImgFileType = "PCX";
break;
case 5:
strImgFileType = "DCX";
break;
case 6:
strImgFileType = "JPG";
break;
case 7:
strImgFileType = "XIF";
break;
case 8:
strImgFileType = "GIF";
break;
case 9:
strImgFileType = "WIF";
break;
}
frmInfo.m_FileType = strImgFileType;
// Read the CompressionType property and translate the value to
// a corresponding string.
switch (ImgAdmin1.GetCompressionType())
{
case 0:
strImgCompType = "Unknown";
break;
case 1:
strImgCompType = "No Compression";
break;
case 2:
strImgCompType = "Group3(1D)";
break;
case 3:
strImgCompType = "Group3(Modified Huffman)";
break;
case 4:
strImgCompType = "PackBits";
break;
case 5:
strImgCompType = "Group4(2D)";
break;
case 6:
strImgCompType = "JPEG";
break;
case 7:
strImgCompType = "RBA";
break;
case 8:
strImgCompType = "Group3(2D)";
break;
case 9:
strImgCompType = "LZW";
break;
}
frmInfo.m_CompType = strImgCompType;
// Read the PageType property and translate the value to a
// corresponding string.
switch (ImgAdmin1.GetPageType())
{
case 0:
strImgPageType = "Unknown";
break;
case 1:
strImgPageType = "Black and White";
break;
case 2:
strImgPageType = "4 bit grayscale";
break;
case 3:
strImgPageType = "8 bit grayscale";
break;
case 4:
strImgPageType = "4 bit palettized";
break;
case 5:
strImgPageType = "8 bit palettized";
break;
case 6:
strImgPageType = "24 bit RGB";
break;
case 7:
strImgPageType = "24 bit BGR";
break;
}
frmInfo.m_PageType = strImgPageType;
// Determine the dimensions of the image page.
long lInfo = ImgAdmin1.GetImageHeight();
frmInfo.m_Height.Format("%i",lInfo);
lInfo = ImgAdmin1.GetImageWidth();
frmInfo.m_Width.Format("%i",lInfo);
// Determine the X and Y resolution of the image page.
lInfo = ImgAdmin1.GetImageResolutionX();
frmInfo.m_XRes.Format("%i",lInfo);
lInfo = ImgAdmin1.GetImageResolutionY();
frmInfo.m_YRes.Format("%i",lInfo);
// Determine the number of pages in the file.
lInfo = ImgAdmin1.GetPageCount();
frmInfo.m_PageCount.Format("%i",lInfo);
// Show the form with the image attributes.
frmInfo.DoModal();
}