CFileDialog i want select only directories
-
It's possible set a file dialog (CFileDialog) to let select to user only directories? I want to do this to choose the work directory of my software. Somebody can help me? Thanks a lot
See the FAQ 4.13 How do I prompt the user to select a directory?[^] --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
-
It's possible set a file dialog (CFileDialog) to let select to user only directories? I want to do this to choose the work directory of my software. Somebody can help me? Thanks a lot
Or here's a function that i use to return the folder name in a CString:
CString GetFolder() { LPMALLOC pMalloc,pMalloc2; CString strDirectory; BROWSEINFO bi; CString strPath1,strPath2; /* Gets the Shell's default allocator */ char pszBuffer[MAX_PATH]; LPITEMIDLIST pidl; // Get help on BROWSEINFO struct - it's got all the bit settings. bi.hwndOwner = GetDesktopWindow(); bi.pidlRoot = NULL; bi.pszDisplayName = pszBuffer; bi.lpszTitle = _T("Select First Directory"); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE; bi.lpfn = NULL; bi.lParam = 0; if (::SHGetMalloc(&pMalloc) == NOERROR) { if ((pidl = ::SHBrowseForFolder(&bi)) != NULL) { if (::SHGetPathFromIDList(pidl, pszBuffer)) { strDirectory = pszBuffer; } pMalloc->Free(pidl); } pMalloc->Release(); } return strDirectory; }
If I write code in my sleep, does that make me brilliant, or just a lazy programmer? My articles www.stillwaterexpress.com BlackDice - the programmer formerly known as bdiamond