Filling a List box with files from a dir
I am trying to use the DlgDirList command.
This is my call (to test I will need to change dir later on)
CWnd::DlgDirList("C:\\", IDC_DirTree, 0, DDL_DIRECTORY);
It will run, but nothing appears in my list box, does this need to be a TreeCtl window from the control box? Or does it matter, I have tried both ways, and neither works.
Thx,
Tony
Re: Filling a List box with files from a dir
Try "C:\\*.*" as the search path.
Re: Filling a List box with files from a dir
That didn't fix it
any other ideas.
the IDC_DirTree is a list box... is that the right code for the list box?
Re: Filling a List box with files from a dir
Yes, I think that is right.
Is the code used in a member function of a class derived from CDialog ?
Re: Filling a List box with files from a dir
Yes it is. It is a list box on my front dialog.
Would an UpdateData commmand clear the files out?
I wouldn't think so but since I don't have any other ideas....
Re: Filling a List box with files from a dir
Ok I got the list box to fill finally, but how do i get it to list only directories, and no files?
I am pretty close now....
Re: Filling a List box with files from a dir
The docs for CWnd::DlgDirList list all of the file type options.
DDL_DIRECTORY should list only directories.
You might try adding the DDL_EXCLUSIVE flag also,
or-ed with the directory flag.
Re: Filling a List box with files from a dir
besides
DlgDirList(dir, IDC_DirTree, 0, DDL_EXCLUSIVE);
what do i need to make it only dirs
Re: Filling a List box with files from a dir
Try this as the last argument to the call :
DDL_DIRECTORY | DDL_EXCLUSIVE