Solved

CListCtrl - Which item is selected?

Posted on 1998-11-05
1
251 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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