BUG: Wrong Selected Item Count on Canceled Selection Change for Listview Control (311891)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API)

This article was previously published under Q311891

SYMPTOMS

When the parent window procedure of a list view control prevents an item selection change by returning TRUE when handling the LVN_ITEMCHANGING notification, the list view control's internal selected item count is updated incorrectly, as if the selection change was permitted.

If the application later sends LVM_GETSELECTEDCOUNT messages to the list view control, the result is an incorrect count of the selected items.

RESOLUTION

You can synchronize the list view's count of selected items by using the LVM_SETITEMSTATE message to clear the selection of all selected items and then reselect them. This causes the list view to correctly update its internal count of selected items.>

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:10/22/2002
Keywords:kbbug kbDSupport kbListView KB311891