Article View: att.lang.c++
Article #216ListCtrl
From: Joe Walsh
Date: Thu, 20 Aug 1998 00:00
Date: Thu, 20 Aug 1998 00:00
52 lines
1676 bytes
1676 bytes
Hello there.
I'm having a bit of a problem with a list control I am trying to use
in a project. I have derived my own class from the CListCtrl class.
I use the following code to insert items. (I found it in an example)
BOOL MyListView::AddItem(int nItem,int nSubItem,LPCTSTR strItem,int
nImageIndex)
{
LV_ITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = nItem;
lvItem.iSubItem = nSubItem;
lvItem.pszText = (LPTSTR) strItem;
if(nImageIndex != -1){
lvItem.mask |= LVIF_IMAGE;
lvItem.iImage = nImageIndex;
}
if(nSubItem == 0)
return InsertItem(&lvItem);
return SetItem(&lvItem);
}
I use the following function to get the icon index. (Also from an
example)
int MyListView::GetIconIndex(const CString& csFileName)
{
SHFILEINFO sfi;
SHGetFileInfo(
(LPCTSTR)csFileName,
0,
&sfi,
sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
return sfi.iIcon;
}
The code runs OK. My problem is that the icons for the files I insert
do not show up.
Also, subitems do not show up in report style.
Any ideas as to what I amy be doing wrong?
Any suggestions appreciated.
b.t.w. I'm pretty green when it comes to VC++.
Technical Details
Message-ID:
<35dbe103.73191458@news.iol.ie>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,7f03c9d2cd1d4b0f,start X-Google-Attributes: gid10d4ba,public From: jwalsh@fallonconsultants.com (Joe Walsh) Subject: ListCtrl Date: 1998/08/20 Message-ID: <35dbe103.73191458@news.iol.ie> X-Deja-AN: 382936351 Organization: C.I.S. Eireann Reply-To: jwalsh@_remove_fallonconsultants.com Newsgroups: att.lang.c++