ImageGear for C and C++ on Windows v20.5 - Updated
IG_page_count_get_FD
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Info Functions > IG_page_count_get_FD

This function obtains the number of pages in the image file specified by its file handle.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_page_count_get_FD(
   AT_INT fd,
   LONG lOffset,
   LPUINT lpPageCount
);

Arguments:

Name Type Description
fd AT_INT Handle of the open file. This handle can be obtained from Microsoft Windows function such as CreateFile(), and cast to AT_INT for passing to the function parameter. FILE pointers returned by functions such as fopen(), and file handles returned by functions such as _sopen_s() are not supported.
lOffset LONG Offset into the file, in bytes, to where the image begins. This is the offset to the beginning of the header, not to the beginning of the bitmap. lOffset is usually 0.
lpPageCount LPUINT Pointer to a UINT variable to receive page count .

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Filters, FlashPix, Vector

Example:

 
Copy Code
HANDLE fd;                // File Descriptor
UINT nPages;            // Will receive number of pages
AT_ERRCOUNT nErrcount;  // Count of returned errors

fd = CreateFile(_T("picture.bmp"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fd != INVALID_HANDLE_VALUE)
{
    nErrcount = IG_page_count_get_FD((AT_INT)fd, 0, &nPages);
    CloseHandle(fd);
}

Remarks:

Call this function when the file is already opened and you have its File Descriptor handle (fd).

See Also

IG_fltr_pagecount_FD_format

Is this page helpful?
Yes No
Thanks for your feedback.