Article View: borland.public.cppbuilder.nativeapi
Article #830Re: Get the icon by using "SHGetFileInfo"...
From: remmurds
Date: Sun, 02 Dec 2007 18:40
Date: Sun, 02 Dec 2007 18:40
55 lines
2651 bytes
2651 bytes
Thank you for your response :) I try to use this function to get the icon: SHGetFileInfo(FileName.c_str(), 0, &info, sizeof(info), SHGFI_LARGEICON | SHGFI_SYSICONINDEX); DrawIconEx(ImageIco->Canvas->Handle, 0, 0, info.hIcon, 48, 48, 0, 0, DI_NORMAL | DI_COMPAT); But it doesn't work. Do I use it with incorrect parameters? "Asger Joergensen" <junk@Asger-P.dk> ���g��l��s�D:MPG.21bd0b1963f2bda698992f@newsgroups.borland.com... > > Hi remmurds > > remmurds says: >> >> But however the icon which i get is only 32*32 pixels, not the original >> 48*48, How do I get it? > > According to the help file: > SHGFI_ICON > Retrieves the handle of the icon that represents the file > and the index of the icon within the system image list. > The **handle** is copied to the **hIcon** member of the > structure specified by psfi, and the index is copied to > the iIcon member. > The return value is the handle of the system image list. > > It looks like You have to deal with the hIcon handle > > and then use the: > > DrawIconEx( > HDC hdc, // handle to device context > int xLeft, // x-coordinate of upper left corner > int yTop, // y-coordinate of upper left corner > HICON hIcon, // handle to icon to draw > int cxWidth, // width of the icon > int cyWidth, // height of the icon > UINT istepIfAniCur, // index of frame in animated cursor > HBRUSH hbrFlickerFreeDraw, // handle to background brush > UINT diFlags // icon-drawing flags > ); > > To draw the Icon. > > Let me know if it works, I haven't tryed it. > > Kind regards > Asger
Technical Details
Message-ID:
<4752fc27$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4751fbc8$1@newsgroups.borland.com> <MPG.21bd0b1963f2bda698992f@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bee658860984a9b7 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII From: "remmurds" <remmurds.bbs@ptt.cc> Newsgroups: borland.public.cppbuilder.nativeapi References: <4751fbc8$1@newsgroups.borland.com> <MPG.21bd0b1963f2bda698992f@newsgroups.borland.com> Subject: Re: Get the icon by using "SHGetFileInfo"... Date: Mon, 3 Dec 2007 02:40:29 +0800 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.3959 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 NNTP-Posting-Host: 140.130.34.19 Message-ID: <4752fc27$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1196620839 140.130.34.19 (2 Dec 2007 10:40:39 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail X-Original-Bytes: 2497