Click to See Complete Forum and Search --> : Filling a List box with files from a dir


Tony Best
July 26th, 1999, 09:27 AM
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

Gomez Addams
July 26th, 1999, 11:59 AM
Try "C:\\*.*" as the search path.

Tony Best
July 26th, 1999, 12:05 PM
That didn't fix it
any other ideas.

the IDC_DirTree is a list box... is that the right code for the list box?

Gomez Addams
July 26th, 1999, 12:13 PM
Yes, I think that is right.
Is the code used in a member function of a class derived from CDialog ?

Tony Best
July 26th, 1999, 01:27 PM
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....

Tony Best
July 26th, 1999, 03:25 PM
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....

Gomez Addams
July 26th, 1999, 03:47 PM
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.

Tony Best
July 26th, 1999, 03:58 PM
besides
DlgDirList(dir, IDC_DirTree, 0, DDL_EXCLUSIVE);

what do i need to make it only dirs

Gomez Addams
July 26th, 1999, 04:05 PM
Try this as the last argument to the call :
DDL_DIRECTORY | DDL_EXCLUSIVE