Dimitrie O. Paun wrote: [snip]
The problem is that WM_STYLECHANGED is sometimes sent, sometimes not, and it seems so much easier to just update it every time we come in so we can be sure we're using the latest value, as we should. It's redundant, I agree, but it's neglijable in terms of performance so I've put it in due to it's simplicity. This way the dwStyle has a very simple to understand semantics. In fact, I've meant to remove it eventually, just like you did, but only as an optimization. However, doing so to fix a bug in a way that we don't understand worries me greatly. I'd rather keep it in, and fix the problem.
I did another test. I intserted a code into the ListView window procedure to print a message every time the internal dwStyle member doesn't match the one returned by GetWindowLong with GWL_STYLE. To my little surprise they were different right from the beginning (even for WM_CREATE message). The one returned by GetWindowLong didn't contain the listview specific flags, WS_VSCROLL/WS_HSCROLL sometimes didn't match (as I explained why) and for the WS_CREATE message the WS_VISIBLE flag was different. I searched my local MSDN copy in order to find why this happens and the only relevant article I found is this: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q83366. The "SUMMARY" part of the article sort of explains why this happens (at least according to my understanding) and so I think the patch is OK. Do you agree?
- Filip