Solved

CListCtrl - Which item is selected?

Posted on 1998-11-05
1
247 Views
Last Modified: 2013-12-03
I am writting an application in VC5 and using an MFC  CListCtrl.  I can't seem to find any WM_ messages or overiable function which notify me of when an item is selected.

How do you find out when an item is selected in the list and which one it is?
0
Comment
Question by:Gumpster
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 150 total points
ID: 1415748
LVN_ITEMCHANGED notification is sent to you after an item has changed

LVN_ITEMCHANGING notification is sent just before an item is changing

Use GetNextItem to find which item is selected.

      int nItem = m_list.GetNextItem( -1, LVNI_SELECTED ) ;

// nItem is now -1 if nothing is found - or 0 or greater : meaning the index of the item

The -1 in the parameter list is where to start searching from (-1 means from the start, 0 or greater meaning the index of the item).  If you are looking for multiple selections, repeatedly call this function to find the next item item
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now