ListBox_Dir macro

Adds names to the list displayed by a list box. The macro adds the names of directories and files that match a specified string and set of file attributes. It can also add mapped drive letters to the list box. You can use this macro or send the LB_DIR message explicitly.

Syntax


int ListBox_Dir(
   HWND    hwndCtl,
   UINT    attrs,
   LPCTSTR lpszFileSpec
);

Parameters

hwndCtl

Type: HWND

A handle to the control.

attrs

Type: UINT

The attributes of the files or directories to be added to the list box. For more information, see LB_DIR.

lpszFileSpec

Type: LPCTSTR

A pointer to the null-terminated string that specifies an absolute path, relative path, or filename. An absolute path can begin with a drive letter (for example, d:\) or a UNC name (for example, \\ machinename\ sharename).

Return value

If the message succeeds, the return value is the zero-based index of the last name added to the list. If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new strings, the return value is LB_ERRSPACE.

Remarks

For more information, see LB_DIR.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Windowsx.h

 

 

Show: