正文

CFileDialog详解2007-05-18 11:11:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/12567/25972.html

分享到:

CFileDialog::CFileDialog CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL ); BOOL bOpenFileDialog该参数为指定true是Open,false是Save as 对话框。 LPCTSTR lpszDefExt添加到没有扩展名文件上的扩展名 LPCTSTR lpszFileName应该初始选定的文件名 DWORD dwFlags 自定义标志,当要进行多选的时候添加OFN_ALLOWMULTISELECT LPCTSTR lpszFilterFile of type中的过滤参数例如: CString lpszFilter="位图(*.bmp)|*.bmp|\  全部文件(*.*)|*.*||";   CWnd* pParentWnd父窗口的指针。 CFileDialog::GetFileName 得到打开文件的名字 For example, GetFileName will return "TEXT.DAT" for the file C:\FILES\TEXT.DAT. CFileDialog::GetFileTitle 得到打开文件的标题,不含扩展名。 For example, GetFileTitle will return "TEXT" for the file C:\FILES\TEXT.DAT. CFileDialog::GetFileExt 得到打开文件的扩展名。 For example, if the name of the file entered is DATA.TXT, GetFileExt returns "TXT". CFileDialog::GetPathName 得到打开文件的路径名 For example, GetPathName will return "C:\FILES\TEXT.DAT" for the file C:\FILES\TEXT.DAT. CFileDialog::GetStartPosition得到列表中第一个文件路径的位置。 该函数使用时候,构造函数中的dwFlags必须选定OFN_ALLOWMULTISELECT CFileDialog::GetNextPathName根据选择的位置返回该文件的路径名 For example, GetNextPathName will return "C:\FILES\TEXT.DAT" for the file C:\FILES\TEXT.DAT. CFileDialog::OnShareViolation当用户发生共享时,该函数返回共享警告或提示。一般系统会自动提示 virtual UINT OnShareViolation( LPCTSTR lpszPathName ); If you want to disable share violation checking, use the bitwise OR operator to combine the flag OFN_SHAREAWARE with m_ofn.Flags. CFileDialog::OnFileNameOK使得在对话框输入的文件名生效。一般系统会自动提示    

阅读(5654) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册