🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

LoadImage Vs ExtractIcon

#3162
From: Mike Collins
Date: Thu, 31 Aug 2006 13:56
29 lines
2183 bytes
Hi guys (and girls)

Got a bit of a problem loading some icons and also need some general 
information about using LoadImage....

Firstly, in general, i use LoadImage to load icons out of my resource 
section or some times from a separate resource dll, something like this:

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

- is it necessary to free the handle that is returned from LoadImage using 
DestroyIcon?  I never seem any reference to this when i've seen BCB examples 
and i've never had any resource leaks reported...

Secondly, is there any advantage to using LoadImage api over ExtractIcon? 
The only reason why i ask is that 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.  Below this value, the icons 
are found and loaded without issue, above this, LoadImage fails reporting 
that "The specified resource type cannot be found in the image file".  I've 
tested this on several platforms, currently using BCB 6 Ent, Windows 2003 
Enterprise.

Many thanks in advance...

Mike C 
Technical Details
Message-ID: <44f6ea84$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b9f657fbba67ecb4,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: LoadImage Vs ExtractIcon
Date: Thu, 31 Aug 2006 14:56:17 +0100
Lines: 31
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757
NNTP-Posting-Host: 81.2.92.14
Message-ID: <44f6ea84$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1157032580 81.2.92.14 (31 Aug 2006 06:56:20 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail