Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ListView_SetItemState

Posted on 2000-04-15
1
Medium Priority
?
1,488 Views
Last Modified: 2013-12-03
In my list view I want to highlight the item at the current cursor position. I used ListView_SetItemState with LVIS_SELECTED to highlight the item. The problem is that when the cursor moves to a new item I want to highlight the new item and clear the state of the previous item. If I have the index to the previous item how can I clear its highlighted state?
0
Comment
Question by:nadirkamal
[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
 

Accepted Solution

by:
vessel earned 160 total points
ID: 2719048
hi nadirkamal!

This call will clear the item's highlighted state:
ListView_SetItemState(hwndX, nIndex, 0, LVIS_SELECTED);
and this will select the item:
ListView_SetItemState(hwndX, nIndex, LVIS_SELECTED, LVIS_SELECTED);

ListView_SetItemState(
    HWND hwnd,
    int i,
    UINT state, // 0 if you want to clear bits
                  // or flags (LVIS_SELECTED) to set
    UINT mask   // Bits which you want to set or clear
);
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

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 describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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 a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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