在FilePreview的情况下自定义CFileDialog的一个大问题 [英] Some big problem with customizing CFileDialog in case of FilePreview

查看:257
本文介绍了在FilePreview的情况下自定义CFileDialog的一个大问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于WindowsXP已经过时,我使用的旧应用程序在使用CFileDialog时无效。

在应用程序中,我有一个FileOpenDialog并有自定义预览,因为文本文件位于特殊订单。

有像PNL2,1,81572000,2580,257,4,0,0,0,0,1,0,0 ,,,,,,,这样的行0我想在预览中仅提供特殊信息。



因此,在XP下我有一个FileOpenDialog来打开其中一个文件并在其上挂钩另一个Dialog:

 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模板wirdüberin静态控制innerhalb
// des Dialogs gemacht das die ID stc32(1119)haben muss
//hierüberwirddann 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
}





我试图让它在win7下运行并且必须设置

 m_bVistaStyle = FALSE ; 





然后我自己的对话框出现,但每次按取消或打开时程序都会崩溃。



我尝试了IFileDialogCustomize-Interface但是只有很少的强大动作。



所以我想要的是以下一些:



a)用新的CFiledialog打开我自己的对话框的可能性:

这可能吗,有没有净引用它?我试图找到一些关于它的东西,但是我找不到任何有用的东西,但是读到它可能

不能做我在这里尝试做的事情。 />
b)也许有人创建了一个自己的FileDialog-Class,可以在win7下工作,允许

挂钩对话框,否则就可以进行自定义预览

就可以了。



如果有任何参考或线索如何解决我的问题,请回答这个问题。

解决方案

请参阅 https:/ /msdn.microsoft.com/en-us/library/windows/desktop/bb776913(v=vs.85).aspx#api [ ^ ],对于允许进行一些自定义的新版本。

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.

解决方案

See https://msdn.microsoft.com/en-us/library/windows/desktop/bb776913(v=vs.85).aspx#api[^], for the new version which allows some customization.


这篇关于在FilePreview的情况下自定义CFileDialog的一个大问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆