The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Shantanu Gadgil on September 02, 2006, 09:03:32 AM

Title: LoadImage and OEM icons
Post by: Shantanu Gadgil on September 02, 2006, 09:03:32 AM
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
Title: Re: LoadImage and OEM icons
Post by: sinsi on September 02, 2006, 09:59:52 AM
What does GetLastError return?
Title: Re: LoadImage and OEM icons
Post by: hutch-- on September 02, 2006, 11:42:22 AM
I cannot routinely find the reference for a constant like OIC_SAMPLE on MSDN online. Where does this come from ?
Title: Re: LoadImage and OEM icons
Post by: sinsi on September 03, 2006, 12:53:12 AM
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
Title: Re: LoadImage and OEM icons
Post by: Shantanu Gadgil on September 03, 2006, 04:32:46 AM
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
Title: Re: LoadImage and OEM icons
Post by: sinsi on September 03, 2006, 05:26:18 AM
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...
Title: Re: LoadImage and OEM icons
Post by: Shantanu Gadgil on September 03, 2006, 10:09:25 AM
To sinsi,
Oh well...what to do! Thanks for the previous tip!

Regards,
Shantanu
Title: Re: LoadImage and OEM icons
Post by: sinsi on September 04, 2006, 07:49:48 AM
No worries mate  :U

If you do find out how to get other sizes, let us know eh?
Good luck!