Question

The ListView in Comtl32.dll v6.0 does multiple selection (when using Shift key) as follows (x means selected)

00xxxx
xxxxxx
xxxx00

Earlier versions of ListView do it as follows :

00xx00
00xx00
00xx00

Is there any way to have it do the first way (the comctl32 v6.0 way)?

Thanks John

Was it helpful?

Solution

The short answer is no. But because that seems incomplete...

The ListView does not expose an API that allows you to change its selection behavior, and as Hans obliquely puts it in his comment, the only way to change the behavior of the ListView control found in versions of comctl32.dll prior to version 6.0 is with a time machine. There's a lot of unique behavior built into the ListView control regarding selection events, so even if you were to try and owner draw the control to modify the appearance of the selection behavior, you'd suddenly be faced with having to handle a nearly ridiculous number of window messages that could potentially cause a selection change.

It's also worth pointing out that this question is misguided on an entirely different level. If the user of your application is running a version of Windows that includes a version of comctl32.dll prior to version 6.0, this is the behavior that they expect out of the ListView control. Overriding and changing that would be nothing but confusing to them, because it wouldn't work the same way as every other ListView control found on their computer. By contrast, if the user of your application is running a version of Windows that includes comctl32.dll v6 or later, the ListView control will already perform as you describe by default. (And you shouldn't go wanting to change it for exactly the same reasons.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top