How to load bitmap on Windows Mobile

Source: Internet
Author: User
How to load bitmap on Windows Mobile

 

Currently, I only know three methods.

I. loadbitmap

Function:

You can load a specified bitmap from an execution module.

Prototype:

HBITMAP LoadBitmap(
  __in  HINSTANCE hInstance,
  __in  LPCTSTR lpBitmapName
);

Parameters:

Hinstance [in]

Module handle containing bitmap

Lpbitmapname [in]

A string ending with '/0', containing the name of the resource to be loaded as a bitmap. You can use makeintresource to convert the resource ID.

Return Value:

If yes, a bitmap handle is returned. Otherwise, null is returned.

Note:

If the file name does not exist or the memory is insufficient, function execution fails.

Call deleteobject to delete a loadbitmap object.

Example:

Hbitmap = loadbitmap (g_hinstance, makeintresource (idb_bmp ));

Ii. shloadimageresource

Function:

Converts a view file to a bitmap file. The view resource file must be included in the resource file.

Prototype:

HBITMAP SHLoadImageResource (
HINSTANCE hinst,
UINT uIdImageFile
);

Parameters:

Hinst

[In] Resource handle

Uidimagefile

[In] View File number

Return Value:

If yes, a bitmap handle is returned. Otherwise, null is returned.

Note:

The conversion file types include GIF, PNG, JPG, ICO, and BMP.

When the shloadimageresource object is no longer used, call deleteobject to delete the object.

Example:

Hbitmap = shloadimageresource (g_hinstance, idr_image );

Iii. shloadimagefile

Function:

Read the View File, decompress it, and return the bitmap handle.

Prototype:

HBITMAP SHLoadImageFile (
  LPCTSTR pszFileName

);

Parameters:

pszFileName 
[In] View File name to be loaded

Return Value:

If yes, a bitmap handle is returned. Otherwise, null is returned.

Note:

The conversion file types include GIF, PNG, JPG, ICO, and BMP.

When the shloadimageresource object is no longer used, call deleteobject to delete the object.

Example:

Hbitmap hbmp = shloadimagefile (

(Text ("// my documents // my pictures // waterfall.jpg ")));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.