Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CListCtrl - Which item is selected?

Posted on 1998-11-05
1
Medium Priority
?
262 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 600 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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 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 …
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 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