News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

LoadImage and OEM icons

Started by Shantanu Gadgil, September 02, 2006, 09:03:32 AM

Previous topic - Next topic

Shantanu Gadgil

Hi,
Any idea why this would return NULL???
invoke LoadImage, 0, OIC_SAMPLE, IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR
Same problem for any of the OIC_xxx

This works fine:
invoke LoadIcon, 0, IDI_APPLICATION

Regards,
Shantanu
To ret is human, to jmp divine!

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

hutch--

I cannot routinely find the reference for a constant like OIC_SAMPLE on MSDN online. Where does this come from ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sinsi

Looks like the last parameter needs LR_SHARED
invoke LoadImage, 0, OIC_SAMPLE, IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR OR LR_SHARED

Hutch, OIC_* are defined in winuser.h
Light travels faster than sound, that's why some people seem bright until you hear them.

Shantanu Gadgil

Hello sinsi,
It works with LR_SHARED!!!  :U :U

Another problem though...no matter what dimensions I give (16x16, 48x48) it is giving me handle to a 32x32 icon!!!  :'( :'(

Any tips?

Regards,
Shantanu
To ret is human, to jmp divine!

sinsi

Maybe an OEM icon only comes in one size?
QuotecxDesired
   [in] 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.
Notice that the parameter is called cxDesired, your "desired" width. Windows seems to have a "close is good enough" mentality when
it comes to icons...
Light travels faster than sound, that's why some people seem bright until you hear them.

Shantanu Gadgil

To sinsi,
Oh well...what to do! Thanks for the previous tip!

Regards,
Shantanu
To ret is human, to jmp divine!

sinsi

No worries mate  :U

If you do find out how to get other sizes, let us know eh?
Good luck!
Light travels faster than sound, that's why some people seem bright until you hear them.