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

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
galneweinhawAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
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
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
All Courses

From novice to tech pro — start learning today.