Directories in CTree View
-
Hi, I want to show all the directory (directory structure) in the Tree View How can i do that Sameer
-
Hi, I want to show all the directory (directory structure) in the Tree View How can i do that Sameer
CTreeCtrl::Expand Use the root node as the HTREEITEM and TVE_EXPAND as the 2nd arg Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
CTreeCtrl::Expand Use the root node as the HTREEITEM and TVE_EXPAND as the 2nd arg Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Hi, I'am sory, but i guess u misunderstood my problem. Actually i want to display a tree view in which all the directories of the Drive are listed Sameer
-
Hi, I'am sory, but i guess u misunderstood my problem. Actually i want to display a tree view in which all the directories of the Drive are listed Sameer
Sameer Maggon wrote: Actually i want to display a tree view in which all the directories of the Drive are listed Sorry :-( What you need is
SHBrowseForFolder
Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Sameer Maggon wrote: Actually i want to display a tree view in which all the directories of the Drive are listed Sorry :-( What you need is
SHBrowseForFolder
Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
look at the foll,. article at Codeguru http://www.codeguru.com/treeview/CDirTreeCtrl.shtml
-
look at the foll,. article at Codeguru http://www.codeguru.com/treeview/CDirTreeCtrl.shtml
Hi, I saw that Control, but that control is too heavy. I just want to Display the Directories and not the Files etc. Actually i just want to give a user, selection of a Directory. Please help Sameer
-
Hi, I saw that Control, but that control is too heavy. I just want to Display the Directories and not the Files etc. Actually i just want to give a user, selection of a Directory. Please help Sameer
Sameer Maggon wrote: Actually i just want to give a user, selection of a Directory. Already told you. Use
SHBrowseForFolder
Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
Hi, I saw that Control, but that control is too heavy. I just want to Display the Directories and not the Files etc. Actually i just want to give a user, selection of a Directory. Please help Sameer
You can limit the tree to one level. Best regards, Alexandru Savescu
-
Hi, I saw that Control, but that control is too heavy. I just want to Display the Directories and not the Files etc. Actually i just want to give a user, selection of a Directory. Please help Sameer
Use the foll. code
CString GetUserDirectory()
{
CString strPath ;
char szDisplayName[_MAX_PATH] ;
char *szPath = NULL ;
char *szTitle = _T(" Please Locate Directory : ") ;//Title of Locate DialogBROWSEINFO bi = {0} ; //Init to NULL,so we do not have to fill up some members explicitly to NULL bi.pszDisplayName = &szDisplayName\[0\] ; bi.lpszTitle = szTitle ; bi.ulFlags = BIF\_RETURNONLYFSDIRS | BIF\_RETURNFSANCESTORS ; bi.hwndOwner = NULL ; LPITEMIDLIST pidl = SHBrowseForFolder(&bi) ; if( pidl == NULL ) //User has cancelled operation return strPath ; //Error Check if( !SHGetPathFromIDList(pidl,szPath) ) { AfxMessageBox(" The Path is Invalid ! ") ; return strPath ; } //Release the PIDL thru Shells MAlloc IMalloc \*pMalloc = NULL ; HRESULT hr = SHGetMalloc(&pMalloc) ; if( !SUCCEEDED(hr) ) return strPath ; pMalloc->Free( (void\*)pidl ) ;//Release the PIDL pMalloc->Release() ;//Release the Interface strPath = szPath ;//The Path to the Directory return strPath ;
}
-
Sameer Maggon wrote: Actually i want to display a tree view in which all the directories of the Drive are listed Sorry :-( What you need is
SHBrowseForFolder
Nish
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
Thanx a lot Nish. This solves my problem :)
-
Use the foll. code
CString GetUserDirectory()
{
CString strPath ;
char szDisplayName[_MAX_PATH] ;
char *szPath = NULL ;
char *szTitle = _T(" Please Locate Directory : ") ;//Title of Locate DialogBROWSEINFO bi = {0} ; //Init to NULL,so we do not have to fill up some members explicitly to NULL bi.pszDisplayName = &szDisplayName\[0\] ; bi.lpszTitle = szTitle ; bi.ulFlags = BIF\_RETURNONLYFSDIRS | BIF\_RETURNFSANCESTORS ; bi.hwndOwner = NULL ; LPITEMIDLIST pidl = SHBrowseForFolder(&bi) ; if( pidl == NULL ) //User has cancelled operation return strPath ; //Error Check if( !SHGetPathFromIDList(pidl,szPath) ) { AfxMessageBox(" The Path is Invalid ! ") ; return strPath ; } //Release the PIDL thru Shells MAlloc IMalloc \*pMalloc = NULL ; HRESULT hr = SHGetMalloc(&pMalloc) ; if( !SUCCEEDED(hr) ) return strPath ; pMalloc->Free( (void\*)pidl ) ;//Release the PIDL pMalloc->Release() ;//Release the Interface strPath = szPath ;//The Path to the Directory return strPath ;
}
Thanx for the code, but i had already written the application using MSDN.. Thanx a lot again for the help. Regards Sameer
-
Use the foll. code
CString GetUserDirectory()
{
CString strPath ;
char szDisplayName[_MAX_PATH] ;
char *szPath = NULL ;
char *szTitle = _T(" Please Locate Directory : ") ;//Title of Locate DialogBROWSEINFO bi = {0} ; //Init to NULL,so we do not have to fill up some members explicitly to NULL bi.pszDisplayName = &szDisplayName\[0\] ; bi.lpszTitle = szTitle ; bi.ulFlags = BIF\_RETURNONLYFSDIRS | BIF\_RETURNFSANCESTORS ; bi.hwndOwner = NULL ; LPITEMIDLIST pidl = SHBrowseForFolder(&bi) ; if( pidl == NULL ) //User has cancelled operation return strPath ; //Error Check if( !SHGetPathFromIDList(pidl,szPath) ) { AfxMessageBox(" The Path is Invalid ! ") ; return strPath ; } //Release the PIDL thru Shells MAlloc IMalloc \*pMalloc = NULL ; HRESULT hr = SHGetMalloc(&pMalloc) ; if( !SUCCEEDED(hr) ) return strPath ; pMalloc->Free( (void\*)pidl ) ;//Release the PIDL pMalloc->Release() ;//Release the Interface strPath = szPath ;//The Path to the Directory return strPath ;
}
Do I have to CoInitialize() and Uninitialize() ???
-
Hi, I want to show all the directory (directory structure) in the Tree View How can i do that Sameer
See this article. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com