CFileDialog m_filedialog(FALSE/TRUE);
m_filedialog.domodel()
// TODO: Add your control notification handler code here BROWSEINFO bi={0}; bi.hwndOwner=this->m_hWnd; bi.lpszTitle=" Select Folder ... "; LPITEMIDLIST pIIL=SHBrowseForFolder(&bi); if(pIIL) { CString FPath; SHGetPathFromIDList(pIIL,FPath.GetBuffer(256)); FPath.ReleaseBuffer(); IMalloc *pmal=0; if(SHGetMalloc(&pmal)==S_OK) { pmal->Free(pIIL); pmal->Release(); } //AfxMessageBox(FPath); if (FPath !="") { m_TargetPath.SetWindowText(FPath); OutputFilePath=FPath; } }
enum modes{NONE=0,PATHTEXT=16,NEWFOLDER=64}; bi.ulFlags=NEWFOLDER;
CFileDialogST dlg; int nRetValue; CString sFolder; nRetValue = dlg.SelectFolder(_T("Please select a destination folder"), _T("c:\\"), 0x40|BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS, this); if (nRetValue == IDOK) { sFolder = dlg.GetSelectedFolder(); MessageBox(sFolder, _T("GetSelectedFolder"), MB_ICONINFORMATION); }
CFileDialogST dlg(FALSE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST, _T("All files\0*.*\0"), this); CString sPathName; int nRetValue; nRetValue = dlg.DoModal(); if (nRetValue == IDOK) { sPathName = dlg.GetPathName(); MessageBox(sPathName, _T("GetPathName"), MB_ICONINFORMATION); }