|
-
June 2nd, 1999, 12:52 PM
#1
Open Dialog
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.
-
June 2nd, 1999, 03:32 PM
#2
Re: Open Dialog
Not sure if this helps but check out the constructor for CFileDialog.
-
June 2nd, 1999, 03:50 PM
#3
-
June 2nd, 1999, 05:13 PM
#4
Re: Open Dialog
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);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|