CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 1999
    Posts
    90

    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:lgDirList("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




  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Filling a List box with files from a dir

    Try "C:\\*.*" as the search path.



  3. #3
    Join Date
    Jul 1999
    Posts
    90

    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?


  4. #4
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    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 ?





  5. #5
    Join Date
    Jul 1999
    Posts
    90

    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....




  6. #6
    Join Date
    Jul 1999
    Posts
    90

    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....


  7. #7
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Filling a List box with files from a dir

    The docs for CWnd:lgDirList 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.



  8. #8
    Join Date
    Jul 1999
    Posts
    90

    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


  9. #9
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Filling a List box with files from a dir

    Try this as the last argument to the call :
    DDL_DIRECTORY | DDL_EXCLUSIVE



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured