Rene Greulich
April 19th, 1999, 04:28 AM
Hi
I am trying to create an open-file-dialog which only shows the files "*.sv", but my dialog shows all files.
Hopefully you can help me
Thanks a lot
Rene´
void Telefon::OnImportAdressBook()
{
CFileDialog dlg(true);
static char BASED_CODE szFilter[] = "Text Files (*.sv)|*.sv||";
dlg.m_ofn.lpstrTitle = "Adressbuch importieren";
dlg.m_ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_ENABLEHOOK |OFN_OVERWRITEPROMPT;
dlg.m_ofn.lpstrFilter = szFilter;
char buf[256] = "";
dlg.m_ofn.lpstrFile = buf;
if(dlg.DoModal()==IDOK)
{
CString sPath = dlg.GetPathName();
CFile Telefonbuch;
if(!Telefonbuch.Open(sPath, CFile::modeCreate |
CFile::modeNoTruncate |
CFile::modeReadWrite))
{
AfxMessageBox("Sorry did not work");
}
else
{
CArchive ar(&Telefonbuch, CArchive::load);
Serialize(ar);
ar.Close();
}
Telefonbuch.Close();
}
}
I am trying to create an open-file-dialog which only shows the files "*.sv", but my dialog shows all files.
Hopefully you can help me
Thanks a lot
Rene´
void Telefon::OnImportAdressBook()
{
CFileDialog dlg(true);
static char BASED_CODE szFilter[] = "Text Files (*.sv)|*.sv||";
dlg.m_ofn.lpstrTitle = "Adressbuch importieren";
dlg.m_ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_ENABLEHOOK |OFN_OVERWRITEPROMPT;
dlg.m_ofn.lpstrFilter = szFilter;
char buf[256] = "";
dlg.m_ofn.lpstrFile = buf;
if(dlg.DoModal()==IDOK)
{
CString sPath = dlg.GetPathName();
CFile Telefonbuch;
if(!Telefonbuch.Open(sPath, CFile::modeCreate |
CFile::modeNoTruncate |
CFile::modeReadWrite))
{
AfxMessageBox("Sorry did not work");
}
else
{
CArchive ar(&Telefonbuch, CArchive::load);
Serialize(ar);
ar.Close();
}
Telefonbuch.Close();
}
}