<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Why is there an LVN_ODSTATECHANGED notification when there's already a perfectly good LVN_ITEMCHANGED notification?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2010/10/28/10081818.aspx</link><description>Because you probably don't want to receive 500,000 LVN_ITEMCHANGED notifications.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Why is there an LVN_ODSTATECHANGED notification when there's already a perfectly good LVN_ITEMCHANGED notification?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2010/10/28/10081818.aspx#10082633</link><pubDate>Fri, 29 Oct 2010 05:17:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082633</guid><dc:creator>asf</dc:creator><description>&lt;p&gt;I had to deal with these two messages the other day, if you look at the structs the OD struct maps pretty good to the other struct so I did:&lt;/p&gt;
&lt;p&gt;//deal with other changes?...&lt;/p&gt;
&lt;p&gt;if (LVIF_STATE&amp;amp;pNMLV-&amp;gt;uChanged) {&lt;/p&gt;
&lt;p&gt;NMLVODSTATECHANGE*pLVSC=(NMLVODSTATECHANGE*)pNMLV; //NMLVODSTATECHANGE is much smaller&lt;/p&gt;
&lt;p&gt;pLVSC-&amp;gt;iTo=pNMLV-&amp;gt;iItem; //ok as long as LVN_ODSTATECHANGED is able to deal with iTo==-1&lt;/p&gt;
&lt;p&gt;pLVSC-&amp;gt;iFrom=(-1==pLVSC-&amp;gt;iTo)?0:pLVSC-&amp;gt;iTo;&lt;/p&gt;
&lt;p&gt;goto &amp;quot;handle_LVN_ODSTATECHANGED&amp;quot;;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;A very weird bug I ran into while doing this was that sometimes NMLISTVIEW.iItem would be 16 in a list with 3 items. So I had to deal with both -1 and &amp;gt;myItemCount&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082633" width="1" height="1"&gt;</description></item><item><title>re: Why is there an LVN_ODSTATECHANGED notification when there's already a perfectly good LVN_ITEMCHANGED notification?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2010/10/28/10081818.aspx#10082613</link><pubDate>Fri, 29 Oct 2010 03:52:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082613</guid><dc:creator>Ivo</dc:creator><description>&lt;p&gt;It would be very useful if this message is sent even for regular controls (not owner-data). Imagine if you have to update the selection count like Explorer does in the status bar. If you do that on LVN_ITEMCHANGED, you will have to update it many times after a &amp;quot;select all&amp;quot;. With a single message like LVN_ODSTATECHANGED (or a new one LVN_SELCHANGED) life would be much easier.&lt;/p&gt;
&lt;p&gt;What I&amp;#39;ve done in the past was to post a private message on the first LVN_ITEMCHANGED and set a flag that stops further messages from being posted until the first message is received and processed. It works OK, but if it was done by the list control it would be more efficient.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082613" width="1" height="1"&gt;</description></item><item><title>re: Why is there an LVN_ODSTATECHANGED notification when there's already a perfectly good LVN_ITEMCHANGED notification?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2010/10/28/10081818.aspx#10082214</link><pubDate>Thu, 28 Oct 2010 16:50:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082214</guid><dc:creator>peterchen</dc:creator><description>&lt;p&gt;@Adam Rosenfield: Not if you provide some &amp;quot;instant filter&amp;quot;, e.g. typing a filter term will reduce the list.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082214" width="1" height="1"&gt;</description></item><item><title>re: Why is there an LVN_ODSTATECHANGED notification when there's already a perfectly good LVN_ITEMCHANGED notification?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2010/10/28/10081818.aspx#10082191</link><pubDate>Thu, 28 Oct 2010 15:55:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082191</guid><dc:creator>Adam Rosenfield</dc:creator><description>&lt;p&gt;If you have a listview with 500,000 items in it, that&amp;#39;s quite a usability nightmare! &amp;nbsp;Of course, your point still stands for a much more reasonable size like 5,000 items.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082191" width="1" height="1"&gt;</description></item></channel></rss>