From 11:00 PM CST Friday, Apr 11th - 1:30 PM CST Saturday, Apr 12th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

GetBitmapFromFile

GetBitmapFromFile

int GetBitmapFromFile (char filename[], int *bitmapID);

Purpose

Reads a bitmap image from a file and creates a bitmap object. 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.
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 4.0 and later

Examples

Refer to the following examples that use the GetBitmapFromFile function:

  • apps\iconedit\iconedit.cws

    Open example
  • userint\alphablend.cws

    Open example
  • userint\colview.cws

    Open example
  • userint\ICOViewer.cws

    Open example
  • userint\treeimage.cws

    Open example
  • utility\threading\ThreadPool\ParallelTestInit\ParallelTestInit.cws

    Open example
Was this information helpful?

Help us improve your future ni.com experience.

What are you trying to do?

Submit