Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Selecting an item in listview via windows api.

Selecting an item in listview via windows api.

Scheduled Pinned Locked Moved ATL / WTL / STL
databasejsonhelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco2250
    wrote on last edited by
    #1

    Hi all. I have a listview handle and some item index. I want to select it via windows api. Can someone help me? Thx in advance. Best Regards, Marco Alves.

    S M 2 Replies Last reply
    0
    • M Marco2250

      Hi all. I have a listview handle and some item index. I want to select it via windows api. Can someone help me? Thx in advance. Best Regards, Marco Alves.

      S Offline
      S Offline
      Steve S
      wrote on last edited by
      #2

      Set the item state to include LVIS_SELECTED. If it's a single select, you might need to unset that bit for the current item.

      Steve S Developer for hire

      1 Reply Last reply
      0
      • M Marco2250

        Hi all. I have a listview handle and some item index. I want to select it via windows api. Can someone help me? Thx in advance. Best Regards, Marco Alves.

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        See the FAQ 4.10 How do I programmatically select an item in a list view control?[^]

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        S 1 Reply Last reply
        0
        • M Michael Dunn

          See the FAQ 4.10 How do I programmatically select an item in a list view control?[^]

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          S Offline
          S Offline
          svsundar Vairavan
          wrote on last edited by
          #4

          try SetCurSel(ItemNumber)

          M 1 Reply Last reply
          0
          • S svsundar Vairavan

            try SetCurSel(ItemNumber)

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            That is for a list box, not a list view control

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups