473,385 Members | 1,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

VC++ CListCtrl question.

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::PopulateList(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

Jul 22 '05 #1
4 4059
Joseph Smith wrote:
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::PopulateList(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

Here may not be a right place for your question.
--
Hongzheng Wang

Jul 22 '05 #2
In article <0j******************@news.nnrp.ca>,
Joseph Smith <mo***********@hotmail.com> wrote:

Anyway, I'm having problems with a CListCtrl in report view.


You had best ask about this in a newsgroup focusing on Windows programming
or on VC++, such as one of the comp.os.ms-windows.programmer.* or
microsoft.public.vc.* groups. Here, people focus on
generic, standard, platform-independent C++.

--
Jon Bell <jt*******@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
Jul 22 '05 #3
This is the closest group I could find. If you have a better suggestion,
I'm open to it.

"Hongzheng Wang" <wa******@mails.tsinghua.edu.cn> wrote in message
news:bq**********@news.yaako.com...
Joseph Smith wrote:
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::PopulateList(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

Here may not be a right place for your question.
--
Hongzheng Wang

Jul 22 '05 #4
"Joseph Smith" <mo***********@hotmail.com> wrote in message
news:8f*******************@news.nnrp.ca...
This is the closest group I could find. If you have a better suggestion,
I'm open to it.


Try: microsoft.public.vc.mfc

Also read this: http://www.slack.net/~shiva/welcome.txt

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: mysteron | last post by:
i have vc 2003 installed on my dev machine and was wondering if I can install 2005 beta 2 on the same machine and have both working perfectly and not interfering with each other? TIA
2
by: Chandrakanth | last post by:
How to make the selection in CListCtrl to appear in different color?
2
by: Herbert VON GRÜNENWALD | last post by:
Hi everyone ! I would like to set an ListViewItem at a special position, into a ListView. There is Bounds, but it's a propertie, that can be only get ! (i could to that in MFC with...
0
by: Rajko | last post by:
Here is something I find unusual. I implemented Drag and Drop to CListCtrl. First I created my own class myCListCtrl from CListCtrl. I implemented OnMouseMove and OnLButtonUp message handlers...
0
by: Ivan | last post by:
Hi All, I need to export MFC Class to DLL using MFC in static libraries. I tried to export CListCtrl derrived class. I used __declspec(export/import) in declaration. Application run, but some...
0
by: Ryan Albarelli | last post by:
Here's one I've spent the last 6 hours trying to figure out... I have a CListCtrl derived class. The first time I click an item in the list to select it, I see a lot of multimedia dll's being...
0
by: Victor | last post by:
Hi everybody! VS.NET 2003 C++ MFC project for Windows XP I would like to use a CListCtrl control in a dialog. So I have #include'd "afxcmn.h" in my CMyDialog.h and declared a variable...
1
by: rag84dec | last post by:
Hi, I have many check boxes in a list control.My problem is to uncheck the check box if there is a check box already checked.How can i do??..I tried doing the below but it checks the first check box...
1
by: ggkk | last post by:
How do you prevent a user from resizing the column width of a clistctrl (report view)?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.