J
Joseph Smith
Well I just started playing with VC++ yesterday, so keep it simple if you
can. thx.
Anyway, I'm having problems with a CListCtrl in report view. The first
column seems to display fine, but the other columns don't. Have a look at
my function for adding data:
void CMP3RenamerDlg:
opulateList(CString str) {
CFileFind finder;
LVITEM lvi;
CString item;
CString strWildcard(str);
strWildcard += _T("\\*.mp3");
BOOL bWorking = finder.FindFile(strWildcard);
int i = 0;
while (bWorking)
{
bWorking = finder.FindNextFile();
if (finder.IsDots())
continue;
// Populate the list with file names.
item = finder.GetFileName();
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.InsertItem(&lvi);
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.SetItem(&lvi);
lvi.iSubItem = 2;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.SetItem(&lvi);
i++;
}
finder.Close();
}
I would think that the code above would put the file name into column 0, 1,
and 2. But it doesn't. Column 0 (the default one) works fine, but on most
of the rows, the other columns aren't populated at all. The couple that do
get populated are populated with the wrong file names. Does anybody have
any idea what it is I'm doing wrong here?
Thanks,
Joseph Smith
can. thx.
Anyway, I'm having problems with a CListCtrl in report view. The first
column seems to display fine, but the other columns don't. Have a look at
my function for adding data:
void CMP3RenamerDlg:
CFileFind finder;
LVITEM lvi;
CString item;
CString strWildcard(str);
strWildcard += _T("\\*.mp3");
BOOL bWorking = finder.FindFile(strWildcard);
int i = 0;
while (bWorking)
{
bWorking = finder.FindNextFile();
if (finder.IsDots())
continue;
// Populate the list with file names.
item = finder.GetFileName();
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.InsertItem(&lvi);
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.SetItem(&lvi);
lvi.iSubItem = 2;
lvi.pszText = (LPTSTR)(LPCTSTR)(item);
m_cList.SetItem(&lvi);
i++;
}
finder.Close();
}
I would think that the code above would put the file name into column 0, 1,
and 2. But it doesn't. Column 0 (the default one) works fine, but on most
of the rows, the other columns aren't populated at all. The couple that do
get populated are populated with the wrong file names. Does anybody have
any idea what it is I'm doing wrong here?
Thanks,
Joseph Smith