0

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

Letseatlunch
  • 2,432
  • 7
  • 28
  • 33

1 Answers1

2

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.)

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • FWIW, there is one situation where changing it would be useful and is sorely missed: When the icons are laid out vertically instead of horizontally. Try shift-clicking icons on the Vista or Win7 desktop when there's more than one column of them for an inexplicable result that makes me want to punch a kitten and which MS still haven't fixed. If only it could be fixed by simply setting a different style on the control. (Hmm, now I want to find a way to do this myself, even if it is a giant kludge. I don't like punching kittens! :)) – Leo Davidson Dec 08 '10 at 07:57