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

This function obtains information about the file specified by the file handle, without loading the pixel data. This is an obsolete function, see remarks.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_info_get_FD(
   AT_INT fd,
   LONG lOffset,
   UINT nPage,
   LPAT_MODE lpFileType,
   LPAT_MODE lpCompression,
   LPAT_DIB lpDIB
);

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 for which the info is obtained. Note that page numbers begin at 1, not 0. Set nPage to 1 if this is not a multi-page file.
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.
lpDIB LPAT_DIB Pointer to an AT_DIB 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:

If lpDIB is not NULL, then

else - all pixel formats supported by ImageGear for C and C++.

Sample:

FlashPix

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
AT_DIB atDIB;
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((AT_INT)fd, 0, 1, &nFileType, &nCompression, &atDIB);
    CloseHandle(fd);

    // ...
}

Remarks:

This function is only kept for backward compatibility reasons. Please use IG_info_get_FD_ex instead.

Any of the output parameters such as lpFileType, lpCompression or lpDIB can be NULL, if the corresponding info is not required.

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