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 ")));