Hi using MFC how could I go about getting the listing of folder on a certain drive, say I get the user to choose the drive from a drop down box, how can i then look at that drives contents, but specifically folders.
Thanks.
Printable View
Hi using MFC how could I go about getting the listing of folder on a certain drive, say I get the user to choose the drive from a drop down box, how can i then look at that drives contents, but specifically folders.
Thanks.
My xtree in this FAQ perhaps?
http://faq.cprogramming.com/cgi-bin/...&id=1044780608
Thanks, that will probably help, it's gonna take me a while to understand it properly though.
Another possibility is to use a CListBox control and fill it up with file/directory names with the DlgDirList api. Something like:where this is the CWnd parent object of the CListBox control, IDC_LIST1 is the listbox id and IDC_STATIC_DIR the id of a 'buddy' static control. You might have to fiddle around a bit to get a format to suit (eg. convert short to long filenames).Code://get length of path to windows dir
int len=GetEnvironmentVariable("windir",0,0);
if (len)
{
char *path=new char[len+1];
GetEnvironmentVariable("windir",path,len);
//fill listbox with file/directory names
int ret=::DlgDirList(*this,path,IDC_LIST1, IDC_STATIC_DIR,
DDL_DIRECTORY|DDL_EXCLUSIVE|DDL_SYSTEM);
delete[] path;
}
else
{
//error
}
I don't use mfc much so there may be a more mfc friendly way of implementing this approach that others may be able to suggest.