🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

BCB6: Getting SYS Icons

#4225
From: poojo hackma
Date: Wed, 08 Mar 2006 14:54
33 lines
2495 bytes
I've got a post in borland.public.cppbuilder.attachments with the same 
subject line as this, and Bob Gonder suggested that I post my question here. 
This is my first time posting in the nativeapi group, so please be nice.  :)

In that attachment is a simple project that populates a TListView with files 
and folders.  What is unique about it is the way it uses system icons on the 
items: Everything gets the same icon that Windows has registered for it.

It was simple enough to copy the technique, but I want to extend it to files 
*not* located on my PC (i.e. files over a network).

I want to say, "Give me my PC's default Windows icon for a .cpp, .doc, .pdf, 
.jpg, etc."  I want the icon that my PC has registered for that particular 
type of file to appear in a TListView.

I have been trying to step through the code in the attachments area 
(news:440d9a95@newsgroups.borland.com) to find out where icons are assigned 
and how they are obtained, but it looks like the example starts with a call 
to SHGetDesktopFolder(LPSHELLFOLDER x).

I tried calling:

SHGetFileInfo(strFilename, FILE_ATTRIBUTE_NORMAL, &fileInfo, 
sizeof(SHFILEINFO), SHGFI_USEFILEATTRIBUTES)

...but I don't understand what to assign the fileInfo.iIcon parameter to 
(TListView->Items->ImageIndex = fileInfo.iIcon?) or when to insert it 
(OnCustomDrawItem?).

Thanks in advance for your help.

Regards,
poojo
Technical Details
Message-ID: <440ef041$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9456c511753bafd3,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "poojo hackma" <poojo.com/mail>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: BCB6: Getting SYS Icons
Date: Wed, 8 Mar 2006 08:54:57 -0600
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
X-Antivirus: avast! (VPS 0610-0, 03/06/2006), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 12.45.133.147
Message-ID: <440ef041$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141829697 12.45.133.147 (8 Mar 2006 06:54:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail