CFileDialog
-
how to use the CFileDialog box to open the folder..... i had done to open the .file extension which successfully opening but i am not able to open the folder plz help out this .....
-
how to use the CFileDialog box to open the folder..... i had done to open the .file extension which successfully opening but i am not able to open the folder plz help out this .....
sarfaraznawaz wrote:
how to use the CFileDialog box to open the folder.....
Why not use
SHBrowseForFolder()
instead?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
-
how to use the CFileDialog box to open the folder..... i had done to open the .file extension which successfully opening but i am not able to open the folder plz help out this .....
-
CFileDialog
automatically opens folders as they are selected by the user navigating a directory tree. Perhaps you could clarify your question.The best things in life are not things.
i tried but not able to open or select the particular folder ..... here my code forit void CfolderlockUIDlg::OnBnClickedAdd() { TCHAR szFilters[] = _T (" Allfolders(* *)¦* *¦¦"); CFileDialog dlg (TRUE, _T ("folder "), _T ("folders "),OFN_FILEMUSTEXIST |OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, szFilters,this); //CFileDialog dlg(TRUE,NULL,NULL,OFN_ALLOWMULTISELECT ,NULL,NULL,0); if (dlg.DoModal () == IDOK) { filepath = dlg.GetPathName(); m_edit.SetWindowText(filepath); } } by this it shows all the folder but i cant select the or open the folder
-
i tried but not able to open or select the particular folder ..... here my code forit void CfolderlockUIDlg::OnBnClickedAdd() { TCHAR szFilters[] = _T (" Allfolders(* *)¦* *¦¦"); CFileDialog dlg (TRUE, _T ("folder "), _T ("folders "),OFN_FILEMUSTEXIST |OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, szFilters,this); //CFileDialog dlg(TRUE,NULL,NULL,OFN_ALLOWMULTISELECT ,NULL,NULL,0); if (dlg.DoModal () == IDOK) { filepath = dlg.GetPathName(); m_edit.SetWindowText(filepath); } } by this it shows all the folder but i cant select the or open the folder
Do you want to select the folder or the the file inside the folder? if its the folder then you can use the function that was mentioned by David here is an example for that
BROWSEINFO bi;
ZeroMemory(&bi, sizeof(bi));
TCHAR szDisplayName[MAX_PATH];
szDisplayName[0] = '';bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = szDisplayName; bi.lpszTitle = \_T("Please select a folder for storing received files :"); bi.ulFlags = BIF\_RETURNONLYFSDIRS; bi.lParam = NULL; bi.iImage = 0; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); TCHAR szPathName\[MAX\_PATH\]; if (NULL != pidl) { BOOL bRet = SHGetPathFromIDList(pidl,szPathName); if(FALSE == bRet) return; AfxMessageBox(szPathName); }
and if you are selecting a file then you can see this example SelectDialog - A Multiple File and Folder Select Dialog[^]
-
how to use the CFileDialog box to open the folder..... i had done to open the .file extension which successfully opening but i am not able to open the folder plz help out this .....
CString str; str.Format(_T("All Files (*.dat)|*.dat||"));// change name .dat to any extension you want CFileDialog file_dlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,str); INT_PTR iRet = file_dlg.DoModal(); :)
-
Do you want to select the folder or the the file inside the folder? if its the folder then you can use the function that was mentioned by David here is an example for that
BROWSEINFO bi;
ZeroMemory(&bi, sizeof(bi));
TCHAR szDisplayName[MAX_PATH];
szDisplayName[0] = '';bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = szDisplayName; bi.lpszTitle = \_T("Please select a folder for storing received files :"); bi.ulFlags = BIF\_RETURNONLYFSDIRS; bi.lParam = NULL; bi.iImage = 0; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); TCHAR szPathName\[MAX\_PATH\]; if (NULL != pidl) { BOOL bRet = SHGetPathFromIDList(pidl,szPathName); if(FALSE == bRet) return; AfxMessageBox(szPathName); }
and if you are selecting a file then you can see this example SelectDialog - A Multiple File and Folder Select Dialog[^]
thanks its working..... but one thing that its necessary to make browseinfo as zero memory ......