GetBitmapFromFileEx
int GetBitmapFromFileEx (char filename[], int index, int *bitmapID);
Purpose
Reads a bitmap image from a file at the specified index and creates a bitmap object. You can use GetNumImagesInFile to find out how many images are in a file.
You can pass the bitmap ID this function outputs to any function that accepts a bitmap, such as CanvasDrawBitmap or ClipboardPutBitmap.
You can discard the bitmap object by passing its ID to DiscardBitmap.
You can use the following image types: .tif, .pcx, .bmp, .dib, .rle, .ico, .jpg, .png, .wmf, and .emf.
Regardless of the original color depth of the image file, the bitmap that GetBitmapFromFile creates matches the color depth of the display screen.
Parameters
Input | ||
Name | Type | Description |
filename | char [] | Pathname of the file that contains the image. You can use a complete pathname or a simple filename. If the name is a simple filename, the file is loaded from the directory that contains the executable. |
index | int |
Zero-based index of the image in the file. This parameter is ignored if the file is not an .ico file. If you pass –1, this function behaves the same as GetBitmapFromFile. |
Output | ||
Name | Type | Description |
bitmapID | int | ID that serves as a handle to the bitmap object. You can pass the ID to functions that accept a bitmap, such as CanvasDrawBitmap and ClipboardPutBitmap. To discard the bitmap, pass the ID to DiscardBitmap. Zero is not a valid bitmap ID. |
Return Value
Name | Type | Description |
status | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: User Interface Library
Include file: userint.h
LabWindows/CVI compatibility: LabWindows/CVI 9.0 and later