LB_ADDFILE message

Adds the specified filename to a list box that contains a directory listing.

Parameters

wParam

This parameter is not used.

lParam

A pointer to a buffer that specifies the name of the file to add.

Return value

The return value is the zero-based index of the file that was added, or LB_ERR if an error occurs.

Remarks

The list box to which lParam is added must have been filled by the DlgDirList function.

The LB_INITSTORAGE message helps speed up the initialization of list boxes that have a large number of items (more than 100). It reserves the specified amount of memory so that subsequent LB_ADDFILE messages take the shortest possible time. You can use estimates for the wParam and lParam parameters. If you overestimate, the extra memory is allocated; if you underestimate, the normal allocation is used for items that exceed the requested amount.

For an ANSI application, the system converts the text in a list box to Unicode using CP_ACP. This can cause problems. For example, accented Roman characters in a non-Unicode list box in Japanese Windows will come out garbled. To fix this, either compile the application as Unicode or use an owner-drawn list box.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

Reference

DlgDirList

LB_ADDSTRING