ImageGear for C and C++ on Windows v19.10 - Updated
IG_info_get_FD_ex
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Info Functions > IG_info_get_FD_ex

This function obtains information about the file specified by the file handle, without loading its pixel data.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_info_get_FD_ex(
   AT_INT fd,
   LONG lOffset,
   UINT nPage,
   LPAT_MODE lpFileType,
   LPAT_MODE lpCompression,
   HIGDIBINFO* lphDIB
);

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.
nPage UINT Page number about which to get information, if a multi-page file set to 1 or greater; for a non-multi-page file set to 1.
lpFileType LPAT_MODE Pointer to an AT_MODE variable in which the file type will be returned. See enumIGFormats for possible values.
lpCompression LPAT_MODE Pointer to an AT_MODE variable in which compression type will be returned. See enumIGCompressions for possible values.
lphDIB HIGDIBINFO* Pointer to an HIGDIBINFO structure to which other file information such as width, height, and Bits Per Pixel, will be returned.

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:

None

Example:

 
Copy Code
HANDLE fd;                // File Descriptor
AT_MODE nFileType;        // Will receive an IG_FORMAT_ constant
AT_MODE nCompression;    // Will receive an IG_COMPRESSION_ constant
HIGDIBINFO hDIB;
AT_ERRCOUNT nErrcount;        // Returned count of errors

fd = CreateFile(_T("picture.bmp"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fd != INVALID_HANDLE_VALUE)
{
    nErrcount = IG_info_get_FD_ex((AT_INT)fd, 0, 1, &nFileType, &nCompression, &hDIB);
    CloseHandle(fd);

    // ...
    // Delete DIB info
    IG_DIB_info_delete(hDIB);
}

See Also

IG_info_get_ex