Article View: borland.public.cppbuilder.nativeapi
Article #16048Re: Problems with LoadIcon and MAKEINTRESOURCE
From: Mike Collins
Date: Mon, 02 Jun 2003 00:23
Date: Mon, 02 Jun 2003 00:23
48 lines
3334 bytes
3334 bytes
God helps those who help them selves :-)
Just thought I'd post since I've just resolved the problem that I stated in
my original thread. The problem was with LoadIcon retaining the orginal
handle when trying to reload icons. I found the answer when searching
google out of desperation. MSDN states that:
"Note This function [LoadIcon] hase been superseded by the LoadImage
function." <- please note, the spelling mistake ('hase') was MS's not
mine :-)
which got me looking carefully at LoadImage which seems to always retrieve a
new handle, regardless of whether or not the resource has been loaded
before. I've replaced all LoadIcons with LoadImage - and lone be hold, when
you change the screen resolution - all the correct icons are displayed. Got
there in the end :-)
"Mike Collins" <mikec@kr8.co.uk> wrote in message
news:3ed92ef0@newsgroups.borland.com...
> Hi everyone, just wondering if anyone could help me out with a small
> problem. It's small, but it takes some explaining so here goes:
>
> Under Explorer (the desktop) when you change the colour depth of the
screen,
> explorer reloads all the images (icons) that it is displaying so that it
> displays them correctly. When I examine the resource files for the system
> i.e. shell32.dll I can see that each icon actually consists of many sub
> icons, one for each size (48x48, 32x32 and 16x16) and one for each colour
> (16 bit and 256 bit). So I assume that explorer simply calls
> MAKEINTRESOURCE with the numeric ID for the icon and inturn
MAKEINTRESOURCE
> returns a string ID which relates to the icon. In turn this is passed to
> LoadIcon which loads the relevant icon which most suites the screen
> resolution and icon size. This is described in the help file, thus:
>
> "LoadIcon loads the icon resource only if it has not been loaded;
otherwise,
> it retrieves a handle to the existing resource. The function searches the
> icon resource for the icon most appropriate for the current display."
>
>
> Now I'm trying to achieve the same thing. I have many icons in a resource
> file. Under each icon is all the relevent sub icons of different sizes
and
> colours. At run time I load up the icons using the LoadIcon API, i.e.
>
Technical Details
Message-ID:
<3eda97ff@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ed92ef0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,a5f9b48171f835bf X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-01 17:23:18 PST Reply-To: "Mike Collins" <mikec@kr8.co.uk> From: "Mike Collins" <mikec@kr8.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ed92ef0@newsgroups.borland.com> Subject: Re: Problems with LoadIcon and MAKEINTRESOURCE Date: Mon, 2 Jun 2003 01:23:25 +0100 Lines: 50 Organization: kr8 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 81.2.78.34 Message-ID: <3eda97ff@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054513151 81.2.78.34 (1 Jun 2003 17:19:11 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail