文件对话框
在一个Single Document应用中,怎么获得弹出的文件对话框的指针;
如何给该对话框的文件类型里添加过滤器。
[解决办法]
CFileDialog dlg(TRUE,_T( " "),_T( " "),OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T( "All Files(*.*)|*.*|Text Files(*.txt)|*.txt|Bitmap Files(*.bmp)|*.bmp|| "));
[解决办法]
CFileDialog dlg(true, "*.fax|*.fax ", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT,
"传真文件(*.fax)|*.fax|所有文件(*.*)|*.*|| ");
CString str;
int nID = dlg.DoModal();
if (IDOK == nID)
{
POSITION pos = dlg.GetStartPosition();
while (pos != NULL)
{
str = dlg.GetNextPathName(pos);
AfxMessageBox(str);
}
}
else if (IDCANCEL == nID)
AfxMessageBox( "cancel ");