Click here to Skip to main content
15,905,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Since WindowsXP is out-of-date an older application I have is not working while using CFileDialog.
In the application I have a FileOpenDialog and had a customized preview, because the textfiles are in a special order.
There are lines like "PNL2,1,81572000,2580,257,4,0,0,0,0,0,1,0,0,,,,,,,0" I want to give only special Information in the preview.

So under XP I had a FileOpenDialog to open one of that files and hook an other Dialog on it:
CStapelDatDlg::CStapelDatDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
		DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
		CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
			, m_bDelAfter(0)
		{
			m_ofn.Flags |= (OFN_EXPLORER | OFN_ENABLETEMPLATE);
   m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_STAPELDATEXTDLG); 
	m_bVistaStyle = FALSE;
	// die Positionierung dieses Templates wird über ein Static Control innerhalb
	// des Dialogs gemacht das die ID stc32 (1119) haben muss
	// hierüber wird dann die Positionierung der Customcontrols in Relation zu Defaultdialog gemacht
	// siehe ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.WIN32COM.v10.en/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/aboutcommondialogboxes/openandsaveasdialogboxes.htm
} 


I tried to get it to work under win7 and had to set
m_bVistaStyle = FALSE;


Then my own dialog comes up but the program crashes everytime i press cancel or open.

I tried out the IFileDialogCustomize-Interface but there are only little powerful actions possible.

So what I look for is some of the following:

a) a possibility to open my own dialog with the new CFiledialog:
Is that possible, are there internet references to it ? I tried to find some-
thing about that but I didn't find anything usefull but read that it maybe
impossible to do what I try to do here.
b) Maybe someone created an own FileDialog-Class that works under win7 and allows
to hook dialogs on it or otherwise gives the possibility to put a custom-preview
on it.

If there are any references or clues how to solve my problem, please answer this question.
Posted

1 solution

See https://msdn.microsoft.com/en-us/library/windows/desktop/bb776913(v=vs.85).aspx#api[^], for the new version which allows some customization.
 
Share this answer
 
Comments
ChriDo61 3-Mar-15 3:26am    
I tried working with these but I didn't get the result I wanted. From your hint I got to Preview Handlers but they are too unflexible.

The new idea is to make a dialog with a tree view on the left in which a windows-explorer-like tree with all paths of the system is set up. And if you choose a file a preview is made on the right side of the dialog.

Maybe you have any idea for a good sample of that kind of treeview ?
Richard MacCutchan 3-Mar-15 4:06am    
That's a totally different question. Just create an application with a splitter window. The left side is a TreeView that can expand to show the content of any directory. The right side will show the content of any file selcted in the left. A fairly simple exercise in Windows programming, although it does involve quite a lot of code.

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