|
-
April 19th, 1999, 04:28 AM
#1
CFileDialog
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();
}
}
-
April 19th, 1999, 07:57 AM
#2
Re: CFileDialog
If you want to set lpstrFilter in this manner, I think you need to use '\0' instead of '|'. The '|' character only works in the constructor. Check out the OPENFILENAME struct documentation in the help files.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|