How to let user choose a directory?
-
Hi world, I want a simple dialog box (like CFileDialog) who let the user choose only a directory (not a file)... Can somebody give me a simple example which does that? Thanks in advance... Hello World!!! :) from Raphaël
-
Hi world, I want a simple dialog box (like CFileDialog) who let the user choose only a directory (not a file)... Can somebody give me a simple example which does that? Thanks in advance... Hello World!!! :) from Raphaël
-
There are lots of samples here in CP... http://www.codeproject.com/dialog/#Windows%20Common%20dialogs[^] for example... Hope this helps.
I would have to look in Code Project first, sorry... Hello World!!! :) from Raphaël
-
I would have to look in Code Project first, sorry... Hello World!!! :) from Raphaël
-
Hi world, I want a simple dialog box (like CFileDialog) who let the user choose only a directory (not a file)... Can somebody give me a simple example which does that? Thanks in advance... Hello World!!! :) from Raphaël
SHBrowseForFolder()
-
Hi world, I want a simple dialog box (like CFileDialog) who let the user choose only a directory (not a file)... Can somebody give me a simple example which does that? Thanks in advance... Hello World!!! :) from Raphaël
The following sample browses for a directory:
void BrowseForDir() { char caPathName[MAX_PATH]; caPathName[0] = 0; GetDlgItemText(IDC_MYCTRL_TO_BACKFILL,caPathName,MAX_PATH); BROWSEINFO sBI; memset(&sBI,0,sizeof(BROWSEINFO)); sBI.hwndOwner = m_hWnd; sBI.pidlRoot = NULL; sBI.pszDisplayName = caPathName; sBI.lpszTitle = "Select the folder that contains the desired files"; sBI.ulFlags = BIF_RETURNONLYFSDIRS; sBI.lpfn = NULL; LPITEMIDLIST pidl = SHBrowseForFolder(&sBI); if (pidl) { SHGetPathFromIDList(pidl,caPathName); SetDlgItemText(IDC_MYCTRL_TO_BACKFILL,caPathName); GotoDlgCtrl(GetDlgItem(IDC_MYCTRL_TO_BACKFILL)); } }
onwards and upwards...