自定义打开文件对话框. [英] custom open file dialog.
本文介绍了自定义打开文件对话框.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我遇到了这样的问题:
我需要添加到标准打开文件对话框的文件夹列表中,当用户从该列表中选择项目时,我必须更改当前对话框的文件夹.在此处自定义打开文件对话框的好例子: http://www.codeproject.com/KB/dialog/DavidKotchanFileDialog.aspx
但我无法针对我的情况修改此示例(我无法更改所选文件夹).
谢谢.
Hi!
I have such problem:
I need add to standart open file dialog list of folders and when user select item from this list I have to change current dialog's folder.
There is a very good example of customizing open file dialog here: http://www.codeproject.com/KB/dialog/DavidKotchanFileDialog.aspx
but I can't modify this example for my case ( I can't change selected folder).
Thanks.
推荐答案
CFileDialog_ReadOnly(<=> BOOL bOpenFileDialog,//对文件打开对话框使用TRUE,对文件保存对话框使用FALSE
HWND hwndOwner = NULL,///对话框将相对于此窗口为模式
p " c:\\ windows",//要在其中打开的初始目录(也可以是您想要的任何文件夹. = NUL L,///允许的文件扩展名列表,该对话框将显示
DWORD dwExtsBuffSize = 0,//'pAllowedExts'缓冲区的大小(包括null终止符)
LPCTSTR pDefaultFileExt = NULL,//保存文件时使用的默认扩展名(无点)
The.原来在那里意味着它正在寻找自己的目录.之所以是2个反斜杠,是因为反斜杠是转义符(谷歌它)
Peace,
d3
CFileDialog_ReadOnly(
BOOL bOpenFileDialog, // use TRUE for File Open dialog, FALSE for File Save dialog
HWND hwndOwner = NULL, // dialog will be modal with respect to this window
LPCTSTR pInitialDirectory = "c:\\windows", // initial directory to open in (can also be any folder that you want.)
LPCTSTR pInitialFileName = NULL, // initial filename to display
LPCTSTR pAllowedExts = NULL, // list of allowed file extensions, that dialog will show
DWORD dwExtsBuffSize = 0, // size of 'pAllowedExts' buffer (incl. null terminator)
LPCTSTR pDefaultFileExt = NULL, // default extension to use when saving the file (no dot)
DWORD dwFlags = 0 // flags controlling the dialog style
);
The . that was originally there means that it is looking in it's own directory. The reason that it is 2 backslashes is because the backslash is the escape character (google it)
Peace,
d3
这篇关于自定义打开文件对话框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文