473,799 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(C String 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.FindNext File();

if (finder.IsDots( ))

continue;
// Populate the list with file names.

item = finder.GetFileN ame();

lvi.mask = LVIF_IMAGE | LVIF_TEXT;

lvi.iItem = i;

lvi.iSubItem = 0;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.InsertI tem(&lvi);

lvi.iSubItem = 1;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.SetItem (&lvi);

lvi.iSubItem = 2;

lvi.pszText = (LPTSTR)(LPCTST R)(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 4103
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(C String 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.FindNext File();

if (finder.IsDots( ))

continue;
// Populate the list with file names.

item = finder.GetFileN ame();

lvi.mask = LVIF_IMAGE | LVIF_TEXT;

lvi.iItem = i;

lvi.iSubItem = 0;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.InsertI tem(&lvi);

lvi.iSubItem = 1;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.SetItem (&lvi);

lvi.iSubItem = 2;

lvi.pszText = (LPTSTR)(LPCTST R)(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.nnr p.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.program mer.* or
microsoft.publi c.vc.* groups. Here, people focus on
generic, standard, platform-independent C++.

--
Jon Bell <jt*******@pres by.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.c n> wrote in message
news:bq******** **@news.yaako.c om...
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(C String 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.FindNext File();

if (finder.IsDots( ))

continue;
// Populate the list with file names.

item = finder.GetFileN ame();

lvi.mask = LVIF_IMAGE | LVIF_TEXT;

lvi.iItem = i;

lvi.iSubItem = 0;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.InsertI tem(&lvi);

lvi.iSubItem = 1;

lvi.pszText = (LPTSTR)(LPCTST R)(item);

m_cList.SetItem (&lvi);

lvi.iSubItem = 2;

lvi.pszText = (LPTSTR)(LPCTST R)(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******** ***********@new s.nnrp.ca...
This is the closest group I could find. If you have a better suggestion,
I'm open to it.


Try: microsoft.publi c.vc.mfc

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

--
Peter van Merkerk
peter.van.merke rk(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
1780
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
2159
by: Chandrakanth | last post by:
How to make the selection in CListCtrl to appear in different color?
2
4199
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 CListCtrl.SetItemPosition(...)) thanks
0
1937
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 in class. Unusual : If I don't use RedrawWindow() I get trails from m_dragImage. and second thing is I don't need to use DragShowNolock(FALSE) and DragShowNolock(TRUE) to
0
879
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 messages was not sent to ListCtrl (item click, scrolling by mouse ...). Can anybody help me? Thanks.
0
1884
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 loaded and unloaded causing a noticable delay before the item selects. After that its fine. The funny thing is, my set up is exactly the same as another program I have and it doesn't load anything! I created a stock MFC DLG app with a CListCtrl...
0
2277
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 CListCtrl list; This compiles fine. But now I try to invoke a function list.SetView(0). The compiler says : 'SetView' is not a member of the CListCtrl. I inquired into the afxcmn.h and found that this function is only
1
6632
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 and unchecks the others. void SomeClass::OnCheckboxChanged ( NMHDR* pNMHeader, LRESULT* pResult ) { func(); }
1
5026
by: ggkk | last post by:
How do you prevent a user from resizing the column width of a clistctrl (report view)?
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.