Solved

How to fill a List View Control using DlgDirList or DlgDirListComboBox?

Posted on 2004-10-25
216 Views
Last Modified: 2013-11-20
How do I fill a List View Control using DlgDirList or DlgDirListComboBox?

I can fill a list box with this:

char szPath [255] = {"c:\\"};
int nResult = DlgDirList(szPath,IDC_LIST,IDC_DIRECTORY,DDL_DRIVES | DDL_DIRECTORY);

Can I do the same with a list view control?

thanks
0
Question by:galneweinhaw
    2 Comments
     
    LVL 43

    Accepted Solution

    by:
    Not by default.

    However you can use CFileFind to find the files/directories and add the items individually to the list control.

      CFileFind finder;
       BOOL bWorking = finder.FindFile("*.*");
       while (bWorking)
       {
          bWorking = finder.FindNextFile();
          // do something with finder.GetFileName()
       }
    0
     
    LVL 43

    Expert Comment

    by:AndyAinscow
    Another thought.   You could also cheat.
    Have a list or combo that is hidden.  Fill that as you  posted above.  Then loop throught the contents, get the string and use that as the item to insert into the list control.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now