Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Mike Collins
Fri, 07 Mar 2008 13:25
ExtractIcon and x16 icons
Author: Mike Collins
Date: Fri, 07 Mar 2008 13:25
Date: Fri, 07 Mar 2008 13:25
17 lines
1651 bytes
1651 bytes
Hi all, just got two quick quesitons regarding ExtractIcon - can't seem to find the answers anywhere. 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. Also, if i assign the returned HICON handle to a TIcon (Image1->Picture->Icon->Handle = ExtractIcon(HInstance, "some.exe", 1)) do i need to call DestroyIcon() when i'm finished with it? Thanks in advance, Mike
Re: ExtractIcon and x16 icons
Author: Minas
Date: Fri, 07 Mar 2008 14:12
Date: Fri, 07 Mar 2008 14:12
29 lines
1826 bytes
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
Re: ExtractIcon and x16 icons
Author: Mike Collins
Date: Fri, 07 Mar 2008 16:31
Date: Fri, 07 Mar 2008 16:31
4 lines
1056 bytes
1056 bytes
Wow, that was easy - hadn't looked properly at ExtractIconEx() - though just started to read about it when i saw your reply. Thanks alot... Mike
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads