Click here to Skip to main content
13,044,428 members (111,572 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi, I used CListCtrl::SetItem to set subitem's text after CListCtrl::InsertItem,all value returned is OK,but some(not all) subitem's text can't display normally.Some subitem's grid has nothing.

my code(execute in a for loop):
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT;
lvItem.iItem = GetItemCount();
lvItem.iSubItem = 0;
lvItem.pszText = szFile;
if (InsertItem(&lvItem) >= 0)
	lvItem.iSubItem = 1;
	lvItem.pszText = (LPWSTR)(LPCTSTR)sFileSize;
	lvItem.iSubItem = 2;
	lvItem.pszText = (LPWSTR)(LPCTSTR)sFileFullPath;

values of sFileSize and sFileFullPath is also OK when debuging.
Posted 2-Aug-12 15:39pm
Updated 2-Aug-12 17:06pm
Christian Graus 2-Aug-12 21:42pm
Do we see any pattern in the values that are not working ? Might they be too big to display, for example ? How many items do you have ? Might you be out of memory ?
acmcat 8-Jan-13 2:41am
for example,i want to set filename of a file into a grid cell(subitem), the filename can vary.but some file's filename can not display,it means the target cell has nothing,otherwise,i can not find anything wrong when debugging.

i can try 10,000 or more items into the listctrl object,but the result is the same, no memory error,no warning, if i try to get the text of the cell, the value returned is also very ok but just can not be displayed normally.

and the length of the filename is about within 15, in char.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 2 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100