I have an OverView window with 2 ListViews. In this OverView window, none of the ListView rows can be selected as it is just a scrollable data window. Each ListView is redisplayed in other windows, when another tab is selected. In these separate windows, I allow the rows to be selectable by the following line and it works great.
I tried that. But, unselecting items doesn't prevent the table rows from being selectable in the future. I need them to be unable to be selected on one screen, but able to be selected on another screen. I have only found a way to make the table rows selectable, but once they become selectable, it stays that way. When the ListView is created, by default the rows are not selectable. Since there is a way (stated in my OP) to make the rows selectable, there should be a way to make them not selectable again.
The only way I got it to work, was to hide the table, delete the table object completely, and then recreate it so it goes back to the default condition that is not selectable. Terribly inefficient.
Maybe there is another way more efficient, but I haven't discovered it yet.
Within this message you can tell the system that this items cannot change after you set those items to unselected (using the ListView_SetItemState(...) function).
I see what you are saying. However, when the ListView is created using flags WS_VISIBLE|WS_CHILD|WS_BORDER|LVS_REPORT and populated with items and subitems, there is some initial mechanism where the rows are not yet selectable at all. Apparently, there is no way to know why that is. That is a behind the scenes question, I guess. And, LVS_EX_FULLROWSELECT allows the ability to select a row. There is no WM_NOTIFY in my existing code, so there is another mechanism that allows the ListView to be not selectable after creation using the flags above.
It just seems to me that your WM_NOTIFY method or my recreate method is a lot of unnecessary work (but necessary to get this to work) to simply turn back off any type of selection method.