Demonstrating List-View Backgrounds

List-View backgrounds turn out to have a rather rich configurability, but with the richness comes complexity that Microsoft seems to have some trouble keeping under control. Various bits of the functionality are either not documented at all, or only vaguely, and the whole is riddled with quirks.

In preparing these notes on List-View backgrounds and the relevant messages and structures, I have resorted not just to an occasional scrap of code to test this or that deduction: I have instead ended up with a substantial test rig which I make available here as a demonstration of both the good about List-View backgrounds and the plainly silly.

The LVBKTEST program presents a main window, containing a List-View control and a menu for acting on this control, particularly on its background. Run with /? for the syntax of configurable options:

Broadly speaking, each menu item corresponds to one window message. This helps demonstrate, for instance, that changing the background colour is two operations: one to send an LVM_SETBKCOLOR message, and another to redraw the control. Some menu items produce dialog boxes to gather parameters for the corresponding window message.

The List-View is populated only with a little sample data. Indeed, it is the same data that Microsoft uses for an SDK sample, because I mean to make the point that a demonstration (or test rig) such as this ought to be Microsoft’s work. There seems a reasonable suspicion that the feature’s bugs and quirks exist (and persist) mainly because Microsoft’s development of the feature is more about supporting Microsoft’s higher-level products than about providing a platform for the generality of non-Microsoft programming. While Microsoft makes an operating system, including its shell, it is not enough for Microsoft to test just that the features work in the various cases that Microsoft happens to use for Microsoft’s other purposes. General features need to be tested generally. That this hasn’t been done for List-View controls will be plain enough from a few minutes with the LVBKTEST program to verify any points of behaviour that are documented in these notes.

For distribution, the built program (x86) is supplied with source code, compressed into one zip file: click here to download the List-View Background Test program.