static TCHAR BASED_CODE szHTMLFilter[] = _T("HTM Files (*.htm) and *.htm and HTML Files (*.html) and *.html and All Files (*.*) and *.* and and ");//设定可浏览的文件的扩展名.
// Bring up a file dialog to browse for HTML files.
CFileDialog dlgHTML(TRUE,
_T("htm"),
NULL,
OFN_EXPLORER,
szHTMLFilter,//加在这里
this);
dlgHTML.m_ofn.lpstrTitle = _T("Navigate to HTML file");//设定文件对话框的标题!
若还不清楚,请到Visual C++下载例程http://yusuco.myrice.com/slgkf/ex9.zip
我认为我说得很清楚了!
CFileDialog dlg(TRUE, "cfg", sFileName, OFN_HIDEREADONLY and OFN_OVERWRITEPROMPT,
"局向配置文件(*.cfg) and *.cfg");
if(dlg.DoModal()==IDOK)
{
//Do what you want
}