Click to See Complete Forum and Search --> : Open Dialog
Behemoth
June 2nd, 1999, 12:52 PM
Hey everyone,
I don't really care whether there's an example of this in either VC or VB, but I'm not sure how to a an Open File Dialog where users should only be able to open or select directories. Although the VB dialog interface is very simple...it doesn't look like there's a simple way to filter out all files except directories and allow users to both do directory crawls and select directories.
PeterK
June 2nd, 1999, 03:32 PM
Not sure if this helps but check out the constructor for CFileDialog.
Ravi Bhavnani
June 2nd, 1999, 03:50 PM
There are 5 examples of this at:
http://www.codeguru.com/dialog/index.shtml
/ravi
Sam Hobbs
June 2nd, 1999, 05:13 PM
An aternative is to use SHBrowseForFolder. The following is not exactly what you would need, but it is probably close.
void CDialogsDlg::OnSysFldrs() {
LPITEMIDLIST pidlBrowse=NULL;
CString SystemFolder;
LPMALLOC g_pMalloc;
BROWSEINFO bi;
if (!SUCCEEDED(SHGetMalloc(&g_pMalloc))) {
MessageBox("Internal error: Malloc failure", AfxGetAppName());
return;
}
if (!SUCCEEDED(SHGetSpecialFolderLocation(m_hWnd, CSIDL_DESKTOP, &pidlBrowse))) // CSIDL_NETWORK
MessageBox("Internal error: special folder not found", AfxGetAppName());
else {
bi.hwndOwner = m_hWnd;
bi.pidlRoot = pidlBrowse;
bi.pszDisplayName = SystemFolder.GetBuffer(MAX_PATH);
bi.lpszTitle = "Sample System Folders Dialog";
bi.ulFlags = 0; // BIF_BROWSEFORCOMPUTER;
bi.lpfn = NULL;
bi.lParam = 0;
pidlBrowse = SHBrowseForFolder(&bi);
SystemFolder.ReleaseBuffer(-1);
MessageBox(SystemFolder, AfxGetAppName());
}
if (pidlBrowse != NULL)
g_pMalloc->Free(pidlBrowse);
}
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.