July 4th, 2025
0 reactions

Why doesn’t LVIF_INDENT work without an image list?

The LVIF_INDENT property of the Win32 classic listview control lets you indent an item in report view. The units of indentation are the size of the image list. But that requires an image list. Why does it require an image list?

The indentation feature of the classic listview control was added for Internet Mail and News, a mail and newsreader program that came with Internet Explorer 3.¹ The indentation was used to represent message threading. Since the indentation was intended to represent reply depth, it was not unreasonable for the listview’s representation of the indentation to match the underlying data’s indentation. And since each item had an icon (representing read or unread), the width of the icon was a natural unit of indentation.

But what if you don’t want an image list?

The indentation demands an image list, but you can provide a 1 × 1 image list, and choose not to show any images. The space will still be reserved, so there will be a 1 pixel gap, but maybe this small glitch isn’t noticeable. The indentation would then be in units of pixels.

Not great, but it might be the best you can do.

¹ Internet Mail and News was subsequently rebranded as Outlook Express, a rebranding which created confusion and unmet expectations.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

1 comment

  • Lappan Sommer

    That does seem like a case of “premature abstraction”, ie drawing up an interface derived from too few or insufficiently diverse examples. Leading of course to suffering all round since the users have to work with a weirdly prickly interface and the developers have to ensure it stays forever identically prickly

    (They can always mark the old behaviour as deprecated so it feels as if the nightmare will be over, but unless they can arrange enough down votes to bury the Stack Exchange answer that explains how to use that interface it will live forever)