Code: Select all
void CFileDialogExt::OnTypeChange()
{
// TODO: Add your specialized code here and/or call the base class
CFileDialog::OnTypeChange();
CString sExt(GetFileExt());
switch(GetOFN().nFilterIndex)
{
case 1:
sExt.Format(_T("bmp"));
break;
case 2:
sExt.Format(_T("gif"));
break;
case 3:
sExt.Format(_T("jpg"));
break;
case 4:
sExt.Format(_T("png"));
break;
case 5:
sExt.Format(_T("tiff"));
break;
}
SetDefExt((LPCSTR)(LPCTSTR)sExt);
}
pun un nume fiser: test
aleg extensia gif. - nu se intampla nimic.
aleg extensia jpg - numele fisierului se schimba in test.gif
aleg extensia png - numele fisierului se schimba in test.jpg
Baiu e ca nu am acces la combobox-ul de extensii, in cazul cand CFileDialog are VistaStyle ... atasez si un proiect de test, VS2008. Care ar putea fi solutia acestei probleme ?
P.S. Filtrul arata in felul urmator:
Code: Select all
LPTSTR szFilter = _T("Bitmap Files (*.bmp)|*.bmp|Gif Files (*.gif)|*.gif|Jpeg Files (*.jpg)|*.jpg|Png Files (*.png)|*.png|Tiff Files (*.tiff)|*.tiff||");
CFileDialogExt dlg(FALSE, NULL, NULL, OFN_FILEMUSTEXIST, szFilter);