🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ExtractIcon and x16 icons

#466
From: Minas
Date: Fri, 07 Mar 2008 14:12
29 lines
1826 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote:
>
> I have a UI and i want to display the (default) icon for a give 
> executable. I'm using a TImage and i want to display the resultant icon as 
> a 16x16 image.  I use ExtractIcon to get the target applications icon 
> (using 0 as the last parameter) but it always returns me a 32x32 icon - 
> maybe i'm missing something about the HICON ? but could anyone tell be how 
> to get the 16x16 image or convert this.

Hi Mike ,

you can use ExtractIconEx

  HICON phiconSmall[1];
  ExtractIconEx(Application->ExeName.c_str() ,0,NULL,phiconSmall,1);
  Image1->Picture->Icon->Handle = phiconSmall[0];

or LoadImage

void __fastcall TForm1::Button2Click(TObject *Sender)
{
  Image3->Stretch = true;
  Image3->Picture->Icon->Handle = LoadImage(HInstance,"MAINICON",IMAGE_ICON, 
16, 16,LR_DEFAULTCOLOR );
}

Best Regards

Minas
Technical Details
Message-ID: <47d14c52@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47d13ff2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,249d4f00026714e4
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Minas" <no email>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47d13ff2$1@newsgroups.borland.com>
Subject: Re: ExtractIcon and x16 icons
Date: Fri, 7 Mar 2008 16:12:52 +0200
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 62.1.168.78
Message-ID: <47d14c52@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1204898898 62.1.168.78 (7 Mar 2008 06:08:18 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail