Microsoft KB Archive/311891

= BUG: Wrong Selected Item Count on Canceled Selection Change for Listview Control =

Article ID: 311891

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft Win32 Application Programming Interface

-



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.

Additional query words: kbGrpUser

Keywords: kbbug kblistview kbnofix KB311891

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.