DlgDirList

 TCHAR path[MAX_PATH ]= {0};
 _tcscpy_s(path, MAX_PATH, _T("C://"));

 DlgDirList(path, IDC_LIST2, 0, DDL_EXCLUSIVE |
      DDL_DIRECTORY);

1.path这里不要用L"c://"这种形式,因为

lpPathSpec
       Points to a null-terminated string that contains the path or filename. DlgDirList modifies this string, which should be long enough to contain the modifications.
  临时对象,指针真的很危险

2.DDL_EXCLUSIVE 要想只显示目录,这个参数要加上

你可能感兴趣的:(c,list,String,Path)