Click here to Skip to main content
16,018,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

I am trying to overload the CFiledialog class such that it stays in only one directory, i.e. change of directory is not allowed.
Like! if i do
C++
Cfileobj.domodal();


it launches a dialog with directory XYZ(assume) N I am not allowed to change the directory neither its parent nor the directory's in XYZ

Is there any way to do it.

Thanks in advance :)
Posted
Updated 4-Aug-11 0:34am
v2

Try using CFileDialog::HideControl()[^]. To find the control IDs, use Spy++.
 
Share this answer
 
You may wish to check out the following article: XFileDialog - Customizing CFileDialog[^]
 
Share this answer
 
I did this way :)

C#
CToolBar* pCtl = (CToolBar*)GetParent()->GetDlgItem(ControlID);//control id from spy ++ it can also be done using hidecontrol
    pCtl->ShowWindow(FALSE);


I was not able to remove the horizontal tool bar on top right of the open dialog so i search through net and found a solution


C++
CToolBarCtrl m_Toolbar;
	CWnd* Child = GetParent()->GetWindow(GW_CHILD);
	while (Child)
	{
		TCHAR clsName[16];
		GetClassName(Child->m_hWnd, clsName, 16);
		if (lstrcmp(clsName, "ToolbarWindow32")==0 && Child->GetDlgCtrlID()==0x0440)
		{
			m_Toolbar.SubclassWindow(Child->m_hWnd);
			break;//do not loop any more, after the job is done
		}
		Child = Child->GetNextWindow();
	}


hope it ll be helpful for some one



Thanks a lot:)
 
Share this answer
 
Hi
I need something similar.

When user is attempting to change folder.
    - I need to check if there any folder is selected or not?
    - If selected I need to check, if any of the selected folder is containing the desired file or not?
    - If the selected folder is having the desired file, then in such case I want to disable the change folder functionality.

Any suggestion will be greatly appreciated!

Thanks
 
Share this answer
 
v2
Comments
abhishek.biradar 27-Feb-13 23:57pm    
Have a look at CMFCShellListCtrl use can overload HRESULT CMFCShellListDerived::EnumObjects(LPSHELLFOLDER pParentFolder, LPITEMIDLIST pidlParent)to get the desired result, u might need some knowledge on list ctrls.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900