{"id":12423,"date":"2010-10-28T07:00:00","date_gmt":"2010-10-28T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/10\/28\/why-is-there-an-lvn_odstatechanged-notification-when-theres-already-a-perfectly-good-lvn_itemchanged-notification\/"},"modified":"2010-10-28T07:00:00","modified_gmt":"2010-10-28T07:00:00","slug":"why-is-there-an-lvn_odstatechanged-notification-when-theres-already-a-perfectly-good-lvn_itemchanged-notification","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20101028-00\/?p=12423","title":{"rendered":"Why is there an LVN_ODSTATECHANGED notification when there&#039;s already a perfectly good LVN_ITEMCHANGED notification?"},"content":{"rendered":"<p>If you <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/06\/15\/429338.aspx\"> work with owner-data listviews<\/a>, you take the responsibility for managing the data associated with each item in the list view. The list view control itself only knows how many items there are; when it needs information about an item, it asks you for it. It&#8217;s the fancy name for a &#8220;virtual list view&#8221; control.\n When you use an ownerdata list view, you will receive a new notification, <code>LVN_ODSTATECHANGED<\/code>. The <i>OD<\/i> stands for ownerdata, so this is an &#8220;owner data state changed&#8221; notification. The list view sends this notification when the state of one or more items in an owner data list view control change simultaneously. Mind you, the list view control can also send the <code>LVN_ITEMCHANGED<\/code> notification if the state of an item changes, so you need to be on the lookout for both.\n If there is a notification <code>LVN_ITEMCHANGED<\/code>, then what&#8217;s the purpose of the <code>LVN_ODSTATECHANGED<\/code> message? It&#8217;s redundant, after all.<\/p>\n<p> Well yes, it&#8217;s redundant, but it&#8217;s faster, too. The <code>LVN_ODSTATECHANGED<\/code> notification tells you that the state of all items in the specified range has changed. It&#8217;s a shorthand for sending an individual <code>LVN_ITEMCHANGED<\/code> for all items in the range [iFrom..iTo]. If you have an ownerdata list view with 500,000 items and somebody does a select-all, you&#8217;ll be glad that you get a single <code>LVN_ODSTATECHANGED<\/code> notification with <code>iFrom=0<\/code> and <code>iTo=499999<\/code> instead of a half million individual little <code>LVN_ITEMCHANGED<\/code> notifications. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you work with owner-data listviews, you take the responsibility for managing the data associated with each item in the list view. The list view control itself only knows how many items there are; when it needs information about an item, it asks you for it. It&#8217;s the fancy name for a &#8220;virtual list view&#8221; [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-12423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>If you work with owner-data listviews, you take the responsibility for managing the data associated with each item in the list view. The list view control itself only knows how many items there are; when it needs information about an item, it asks you for it. It&#8217;s the fancy name for a &#8220;virtual list view&#8221; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=12423"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12423\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=12423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=12423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=12423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}