Solved

CListCtrl - Which item is selected?

Posted on 1998-11-05
1
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

617 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