🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3167

Re: LoadImage Vs ExtractIcon

#3167
From: Remy Lebeau (TeamB)
Date: Thu, 31 Aug 2006 17:37
37 lines
2333 bytes
"Mike Collins" <its@TheBottomOfThePost.com> wrote in message
news:44f6ea84$1@newsgroups.borland.com...

> Image->Picture->Icon->Handle = LoadImage(hDLL,
> MAKEINTRESOURCE(12), IMAGE_ICON, 32, 32,
> LR_DEFAULTSIZE);

You must specify 0 for the cxDesired and cyDesired parameters if you use the
LR_DEFAULTSIZE flag.  This allows the OS to decide which dimensions to load
from the image based on the current display settings.

> is it necessary to free the handle that is returned from
> LoadImage using DestroyIcon?

Yes, but you do not have to do it yourself.  TIcon takes ownership of the
HICON and will free it for you when the TIcon itself is freed, or if you
assign a new HICON to it.

> i'm having a problem using LoadImage to load icons from shell32.dll.  To
> avoid any possible copyright issues, i'm loading some Windows icons
directly
> from \\system32\\shell32.dll, using exactly the same code as above.
However,
> LoadImage seems to fail if i try to load an icon that has an Id grater
than 56.

Without actually seeing the icons for your copy of shell32.dll, my guess
would be that the icons at those higher IDs don't have 32x32 versions
available for them.  You have hard-coded the cxDesired and cyDesired
parameters to always load 32x32 images only.

Which exact IDs are you trying to load?  For example, in my copy of
shell32.dll on Win98, there are no icon groups available between IDs 47-132.


Gambit
Technical Details
Message-ID: <44f7214f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44f6ea84$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b9f657fbba67ecb4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44f6ea84$1@newsgroups.borland.com>
Subject: Re: LoadImage Vs ExtractIcon
Date: Thu, 31 Aug 2006 10:37:57 -0700
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44f7214f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1157046607 68.69.17.41 (31 Aug 2006 10:50:07 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail