please dont rip this site Prev Next

LoadImage info  Overview  Group

The LoadImage function loads an icon, cursor, or bitmap.

HANDLE LoadImage(

    HINSTANCE hinst, 

// handle of the instance that contains the image

    LPCTSTR lpszName,

// name or identifier of image

    UINT uType,

// type of image

    int cxDesired,

// desired width

    int cyDesired,

// desired height

    UINT fuLoad

// load flags



Identifies an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero.
Identifies the image to load.

If the hinst parameter is non-NULL and the fuLoad parameter does not include LR_LOADFROMFILE, lpszName is a pointer to a null-terminated string that contains the name of the image resource in the hinst module.

If hinst is NULL and LR_LOADFROMFILE is not specified, the low-order word of this parameter must be the identifier of the OEM image to load. The OEM image identifiers are defined in WINUSER.H and have the following prefixes:




OEM bitmaps


OEM icons


OEM cursors

Windows 95: If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the image.

Windows NT: LR_LOADFROMFILE is not supported.

Specifies the type of image to be loaded. This parameter can be one of the following values:




Loads a bitmap.


Loads a cursor.


Loads an icon.

Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
Specifies a combination of the following values:




The default flag; it does nothing. All it means is "not LR_MONOCHROME".


When the uType parameter specifies IMAGE_BITMAP, causes the function to return a DIB section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping it to the colors of the display device.


Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.


Loads the image from the file specified by the lpszName parameter. If this flag is not specified, lpszName is the name of the resource.


Searches the color table for the image and replaces the following shades of gray with the corresponding 3D color:


Replaced with

Dk Gray, RGB(128,128,128)


Gray, RGB(192,192,192)


Lt Gray, RGB(223,223,223)



Retrieves the color value of the first pixel in the image and replaces the corresponding entry in the color table with the default window color (COLOR_WINDOW). All pixels in the image that use that entry become the default window color. This value applies only to images that have corresponding color tables.

If fuLoad includes both the LR_LOADTRANSPARENT and LR_LOADMAP3DCOLORS values, LRLOADTRANSPARENT takes precedence. However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.


Loads the image in black and white.


Shares the image handle if the image is loaded multiple times. If LR_SHARED is not set, a second call to LoadImage for the same resource will load the image again and return a different handle.

Do not use LR_SHARED for images that have non-standard sizes, that may change after loading, or that are loaded from a file.

Return Values

If the function succeeds, the return value is the handle of the newly loaded image.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

See Also

CopyImage, GetSystemMetrics, LoadBitmap, LoadCursor, LoadIcon 

file: /Techref/os/win/api/win32/func/src/f53_13.htm, 11KB, , updated: 2001/6/25 07:22, local time: 2024/5/27 15:19,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> LoadImage</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!