Solved

CListCtrl - Which item is selected?

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

838 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