Which List-view item selected?

This is a discussion on Which List-view item selected? within the Windows Programming forums, part of the Platform Specific Boards category; What would I do to know which item in a List-view control is selected. I have it with icons, but ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Which List-view item selected?

    What would I do to know which item in a List-view control is selected. I have it with icons, but I want to know which one is selected when the user clicks a button.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    this code will get the first item in the list view that has been selected:

    Code:
    SendMessage(hWndListView, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM((UINT)LVNI_SELECTED, 0));
    hope that helps!
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Or even

    iIndex=ListView_GetSelectionMark(hwndListView);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    yeah.. was going to paste that too.. but that's just a macro, and it's handy to know what's going on behind the scenes

    good one though nova.

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Immediate programming help! Please!
    By xMEGANx in forum C++ Programming
    Replies: 6
    Last Post: 02-20-2008, 11:52 AM
  2. Recursion Revisited again, and again!
    By clegs in forum C++ Programming
    Replies: 93
    Last Post: 12-08-2007, 07:02 PM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Linked List
    By jpipitone in forum C Programming
    Replies: 4
    Last Post: 03-30-2003, 08:27 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21