L_FileInfoMemory
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_FileInfoMemory(pBuffer, pFileInfo, uStructSize, nBufferSize, uFlags, pLoadOptions)
/* pointer to the file location in memory */ | |
pFILEINFO pFileInfo; |
/* pointer to the LEAD FILEINFO structureFILEINFO */ |
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pFileInfo */ |
L_INT32 nBufferSize; |
/* size in bytes of the file */ |
L_UINT uFlags; |
/* flag */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Loads information about the file located in memory into a FILEINFO structure.
Parameter |
Description |
|
pBuffer |
Pointer to the location in memory of the image file. |
|
pFileInfo |
Pointer to the LEAD FILEINFO structure to be filled with data from the image file. |
|
uStructSize |
Size in bytes, of the structure pointed to by pFileInfo, for versioning. Use sizeof(FILEINFO). |
|
nBufferSize |
The size in bytes of the file referenced by pBuffer. |
|
uFlags |
Flag indicating whether to update the TotalPages field in the FILEINFO structure. Possible values are: |
|
|
Value |
Meaning |
|
FILEINFO_TOTALPAGES |
[0x0001] Update the pFileInfo->TotalPages field with the total number of pages in the file. |
|
0 |
Do not update the pFileInfo->TotalPages field. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To use this function, do the following:
1. |
Declare a variable with the datatype of FILEINFO. |
2. |
Load the file into memory and assign variables for the file's location in memory and for the file size. |
3. |
If you are getting information about a multi-page file (which can contain more than one image), use the LOADFILEOPTION structure to specify the page number. The information that you get will be for the image on the specified page. |
4. |
Call the L_FileInfoMemory function, passing the pointer to the file in memory, the address of the FILEINFO variable, and the file size as parameters. |
5. |
Get the image information from the fields described in FILEINFO structure. |
For a summary of file information functions, refer to Getting and Setting File Information.
Note: More options are available in the LOADFILEOPTION structure.
Note: This function does not support Kodak PhotoCD (PCD) files or Kodak FlashPix files.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.
See Also
For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.
Example
For complete sample code, refer to the MEMORY example.
/* This example loads a temporary bitmap, saves it as a file in memory,
then gets information about the memory-resident file */
BITMAPHANDLE TmpBitmap; /* Bitmap handle for the initial image */
HGLOBAL hFileInMemory; /* Memory handle */
L_UINT32 uMemSize; /* Size of the data in memory */
L_CHAR L_FAR *pData; /* Pointer to the data in memory */
FILEINFO FileInfo; /* LEAD File Information structure. */
L_TCHAR szMessage[1024]; /* Buffer to hold information for display. */
/* Load a bitmap at its own bits per pixel */
L_LoadBitmap (TEXT("image3.cmp"), &TmpBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
/* Save the image as a CMP file in memory */
L_SaveBitmapMemory(&hFileInMemory, &TmpBitmap, FILE_CMP, 24, QS, &uMemSize, NULL);
/* Free the temporary bitmap */
L_FreeBitmap(&TmpBitmap);
/* Get the pointer to the memory-resident file */
pData = (L_CHAR L_FAR *) GlobalLock (hFileInMemory);
/* Get information about the file in memory */
FileInfo.uStructSize = sizeof(FileInfo);
L_FileInfoMemory (pData, &FileInfo, sizeof(FILEINFO), uMemSize, 0, NULL);
/* Unlock the memory */
GlobalUnlock (hFileInMemory);
/* Format the message string with data from the FILEINFO structure */
wsprintf(szMessage, TEXT("Format: %d\n\n")
TEXT("Width: %d\n\n")
TEXT("Height: %d\n\n")
TEXT("BitsPerPixel: %d\n\n")
TEXT("Size of File: %ld\n\n")
TEXT("Size of Bitmap: %ld\n\n")
TEXT("Compression: %s"),
FileInfo.Format,
FileInfo.Width,
FileInfo.Height,
FileInfo.BitsPerPixel,
FileInfo.SizeDisk,
FileInfo.SizeMem,
(L_TCHAR L_FAR *)FileInfo.Compression );
/* Display the message string */
MessageBox( NULL, szMessage, TEXT("File Information"), MB_OK );
/* Clean up the test environment */
GlobalFree (hFileInMemory);