🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: System Icons

#3440
From: Mike Collins
Date: Fri, 09 Jun 2006 09:10
54 lines
2861 bytes
So in reply to your orginal posting, and based on what seems to have 
transpired using SHGetFileInfo(), it would seem that access the icons 
directly from the dll.  You will have to use LoadLibrary on the shell32.dll 
and then use the HINSTANCE that is returned as the handle in any calls to 
image loading api's or vcl functions.  This will also require you to know 
the resource ID for the icons in question but this seems to have remained 
pretty much constant from one shell32 version to another.  These ID's can be 
determined using some sort of resource hacker to such as ExeScope or 
ResHacker.

Code would look something like this:

    HINSTANCE hShell = LoadLibrary("shel32.dll");
    if (hShell)
    {
        Graphics::TIcon   *icoContainer = NULL;
        try
        {
            try
            {
                icoContainer = new Graphics::TIcon();
                istImageList->Height = 32;
                istImageList->Width = istImageList->Height

                icoContainer->Handle = LoadImage(hShell , 
MAKEINTRESOURCE(ICON_RES_ID), IMAGE_ICON, 32, 32, LR_DEFAULTSIZE);
                istImageList->AddIcon(icoContainer);
                ...
                ...
                // repeat for each icon the you need, adjusting the 
ICON_RES_ID accordingly
            }
            catch (...)
            {
            }
        }
        __finally
        {
            if (icoContainer)
            {
                delete icoContainer;
                icoContainer = NULL;
            }
            FreeLibrary(hShell);
        }

HTH, Mike C


"Jeff" <Jeff@nospam.com> wrote in message 
news:448716d6$1@newsgroups.borland.com...
> I've got a TListView component and would like to assign icons to its items 
> from the shell32.dll.  Any way to get the icons from system libraries?
> 
Technical Details
Message-ID: <44893b09$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!t-online.de!newsfeed.freenet.de!news.albasani.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail
References: <448716d6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,de14f1cb04eef46a
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <448716d6$1@newsgroups.borland.com>
Subject: Re: System Icons
Date: Fri, 9 Jun 2006 10:10:31 +0100
Lines: 56
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2663
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 81.2.92.14
Message-ID: <44893b09$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1149844233 81.2.92.14 (9 Jun 2006 02:10:33 -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!t-online.de!newsfeed.freenet.de!news.albasani.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail